题解 | #买房子#
买房子
https://www.nowcoder.com/practice/a4b46b53773e4a8db60b5f7629ce03e9
#include <iostream>
using namespace std;
int main() {
int salary,rate;
while (cin >>salary>>rate) { // 注意 while 处理多个 case
int money=0,count=1;
double house=200;
while(count<=21){
if(money+salary>=house){
cout<<count<<endl;
break;
}
house=house+house*rate*1.0/100;
money+=salary;
count++;
}
if(count>21)
cout<<"Impossible"<<endl;
}
}
// 64 位输出请用 printf("%lld")