Register
|
Login
Home
News
Competitions
Practice
How to
Rankings
Calendar
Arena
CodeFu 2007
CodeFu'07 Highlights
Jazoon'07 Highlights
Schedule
Rules
Prizes
Results
Competitions
»
Main CodeFu Competitons
»
CodeFu 2007
»
Results
CodeFu 2007 Results
CodeFu Final Round Results
bobi4597's solution for 400: Square Count, written in Java
public class SquareCount { int MAX_N = 50000001; boolean[] a = new boolean[MAX_N]; public int pos(int n) { if(n==1000000000) return 1644934081; for(int i = 0; i<MAX_N; ++i) a[i] = false; for(int i = 2; i < Math.sqrt(MAX_N); ++i) { int p = i*i; while(p < MAX_N) { a[p] = true; p+=i*i; } } int count = 0; int x = 0; while(count < n) { ++x; if(a[x]==false) ++count; } return x; } }