You are viewing a single comment's thread. Return to all comments →
In last 5 testcases for n>10^5 I am getting timeout problem... Kindly help me...
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for(int i=0; i<t; i++) { long n = sc.nextLong(); long sum = n; for(long j=2; j<=n; j++) { long k = (n/(j-1)*(n+n%(j-1)-(j-1))/2); sum = sum + k; } System.out.println(sum%1000000007); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Tile Painting: Revisited!
You are viewing a single comment's thread. Return to all comments →
In last 5 testcases for n>10^5 I am getting timeout problem... Kindly help me...