Register
|
Login
Home
News
Competitions
Practice
How to
Rankings
Calendar
Arena
CodeFu 2010
CodeFu'10 Highlights
Jazoon'10 Highlights
Schedule
Rules
Prizes
Results
Competitions
»
Main CodeFu Competitons
»
CodeFu 2010
»
Results
CodeFu 2010 Results
Final Round Results
Vojce's solution for 300: NumberSequence, written in Java, submitted on 09.05.2010 13:24:56
public class NumberSequence { public static int findDigit(int N) { String s=""; int k=1; int broj=0; for(;;) { for(int i=1;i<=k;i++) { // System.out.print(i); if(i<10) broj++; else if(i>9 && i<100) broj+=2; else if(i>99 && i<1000) broj+=3; else if(i>999 && i<10000) broj+=4; else if(i>9999 && i<100000) broj+=5; else if(i>99999 && i<1000000) broj+=6; if(N==broj) { return i%10; } else if(N<broj) { return i/(int)Math.pow((double)10,(double)(broj-N))%10; } } k++; } } }