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 | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 165 |
2 | maomao90 | 163 |
2 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | adamant | 160 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | 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 + = "";