Created
May 27, 2014 06:28
-
-
Save zsrinivas/1d4a17edd0d6621450b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <assert.h> | |
#include <ctype.h> | |
int main(int argc, char const *argv[]) | |
{ | |
int n,c,m,choc=0,upchoc=0; | |
int testc,*pint=&upchoc,wrappers; | |
scanf("%d", &testc); | |
while(testc--) | |
{ | |
choc=0; | |
scanf("%d%d%d", &n,&c,&m); | |
choc=n/c; | |
upchoc=choc; | |
wrappers=upchoc; | |
while(wrappers>=m) | |
{ | |
upchoc=wrappers/m; | |
wrappers-=(upchoc)*m; | |
wrappers+=upchoc; | |
choc+=upchoc; | |
} | |
printf("%d\n", choc); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment