You are viewing a single comment's thread. Return to all comments →
Why does this time out?
import java.util.*; public class q{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); for(int g=0;g<t;g++){ int n=sc.nextInt(),c=sc.nextInt(),m=sc.nextInt(); int totalChoc=0;int wrappers=n/c; while(wrappers>0){ totalChoc=n/c+wrappers/m; wrappers=wrappers%m;} System.out.println(totalChoc);}}}
Chocolate Feast
You are viewing a single comment's thread. Return to all comments →
Why does this time out?