We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
static int cc;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t,n,c,m,r;
t = in.nextInt();
while(t-->0){
n = in.nextInt();
c = in.nextInt();
m = in.nextInt();
r=n/c;
cc=r;
while(r>=m){
cc=cc+r/m;
r=r%m+r/m;
}
System.out.println(cc);
}
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Chocolate Feast
You are viewing a single comment's thread. Return to all comments →
static int cc; public static void main(String[] args) {
}