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
carevski's solution for 400: Square Count, written in Java
public class SquareCount { private static boolean del(long br){ boolean kraj = true; for(int i=2;kraj && i<=Math.sqrt((double)br);i++){ if ( br%(i*i) == 0 ) kraj = false; } return kraj; } public static int pos(int N){ int brojac = 1; while(N>0){ if (!del(brojac)) brojac++; else{ brojac++;N--; } } return brojac-1; } public static void main(String args[]){ System.out.println(SquareCount.pos(1)); } }