You are viewing a single comment's thread. Return to all comments →
package practiceQuestion; import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Trys {
public static void main(String[] args) { Scanner kb= new Scanner(System.in); int N=kb.nextInt(); int c=0;int p=0; int k=kb.nextInt(); // int m=(int) Math.pow(2, k); // System.out.println(m); for(int i=2;i<=N;i++) { int m=(int) Math.pow(i, k); c=0; for(int j=2;j<=N;j++) { if(j%m==0){ p++; // System.out.println(p+".... "+j); } else { c++; // System.out.println(c+" "); } } } p=N-p; System.out.println(p); }
} // can anyone tell me why timeout is giving plz solve this
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #193: Squarefree Numbers
You are viewing a single comment's thread. Return to all comments →
package practiceQuestion; import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Trys {
} // can anyone tell me why timeout is giving plz solve this