/*
CODECHEF
PROBLEM CODE : MONTRANS
*/
#include<stdio.h>
int T,a,b,c;
void solve()
{
int step=0,cnt=0;
int m=a*100+b;
while((a>0||b>=c)&&cnt<10000){
cnt++;
if(b<c)a--,b+=100;
b-=c;
int tmp=a;a=b;b=tmp;
int t=a*100+b;
if(t>m)m=t,step=cnt;
}
printf("%d\n",step);
}
int main()
{
scanf("%d",&T);
while(T--){
scanf("%d%d%d",&a,&b,&c);
solve();
}
return 0;
}
0 comments:
Post a Comment