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 | 4009 |
2 | jiangly | 3821 |
3 | Benq | 3736 |
4 | Radewoosh | 3631 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3388 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 164 |
1 | maomao90 | 164 |
3 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | -is-this-fft- | 158 |
6 | awoo | 157 |
7 | adamant | 156 |
8 | TheScrasse | 154 |
8 | nor | 154 |
10 | Dominater069 | 153 |
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 + = "";