#include
using namespace std;
#define fi first
#define se second
#define IOS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
typedef long long ull;
typedef unsigned long long ll;
const int N = 1e5+10;
const int NN = 1e6+100;
const int pp = 1e9+7;
typedef pair<string,int>PII;
const int inf = 2147483647;
double eps = 1e-5;
int t,cnt;
double a,c,b;
/*首先读完题,我们可以发现一共有两个操作步骤
1. 计算 根据本金计算利息
2. 计算 新本金=本金+利息-还款
已知利息是个整数无误差(要四舍五入)
所以我们考虑精确第二个步骤
我们可以发现每个小数都是小数点后两位,为了消除误差我们可以把小数运算化成整数运算
即把本金和还款化为整数,这样所有的运算就都消除了误差
*/
int main()
{
cin>>t;
while(t--)
{
cin>>a>>b>>c;
bool f=0;
cnt=0;
double a1=a/100.0;//计算出利率
int b1=b*100+eps;//本金化为整数
int c1=c*100+eps;//还款化为整数 注意eps尽量取1e-5 - 1e-7
int e=b1*a1+0.5;//计算出利息
if(e>c1) f=1;//如果第一次利息就大于还款,那么永远都还不完
else//否则计算还款次数
{
while(b1>0)
{
e=a1*b1+0.5;
// cout<
b1=b1+e-c1;
cnt++;
if(cnt==1201)
{
f=1;
break;
}
}
}
if(f) cout<<"impossible\n";
else cout<<cnt<<"\n";
}
}
详见博文:浮点数误差处理