I want to know where is the error on my return...
I cant find the error, and the output result is equals to expected result.
o.O
Someone can help me ?
Thanks;
# | User | Rating |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | djm03178 | 152 |
Name |
---|
By the way it is more important due to mistake pointed out by goo.gl_SsAhv - you may use ans.replaceAll("\\s+", " ") instead to avoid this mistake - and see - here you also use regexps, though in rudimentary form.
If you find another solution you don't know whether your implementation or idea of your solution was wrong, however when you find bug in your implementation you learn more (there is smaller chance to repeat the bug again).
On the other hand, in enterprise programming I do not prefer short solution against the more understandable, but in contest the shorter code is better.
On the other hand, in enterprise programming I do not prefer short solution against the more understandable
It is correct too. However, for string-processing regexp solution could be both more clear and short (though may be less efficient) than imperative. Consider discussed solution of topicstarter and one with regexps (I do not mean it is best approach - here are other regexless solution, short enough).
Follow new correctly solution:
for(inti = 0;i < partInt.length();i + + ){
if((i%3) - MOD = = 0&&i! = 0){
ret + = (", " + partInt.charAt(i));
}else{
ret + = partInt.charAt(i);
}
}
if(Long.parseLong(partFrac) = = 0){
ret + = ".00";
}else{
while(partFrac.length() < 2)
partFrac + = "0";
ret + = "." + partFrac.substring(0, 2);
}
}else{
ret + = "";