Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //start
- int n = strToInt(args[0]);
- int dis = 9;
- int end = 10;
- int i = 1;
- for ( ; n > dis; i++) {
- n -= dis;
- if (i % 2 == 0) {
- dis *= 10;
- end *= 10;
- }
- }
- int start = end/10;
- int c = 1;
- for ( ; start < end; start++) {
- if (c == n)
- break;
- c++;
- }
- int add;
- if (i % 2 == 0) {
- add = convert(start);
- start *= end;
- } else {
- add = convert(start/10);
- start *= end/10;
- }
- //end
- int res = start + add;
- core.out(res + " : answer");
- }
- public int convert(int i) {
- int r = 0;
- while (i > 0) {
- r = 10 * r + i % 10;
- i = i / 10;
- }
- return r;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement