求P11310的题解
本人代码
#include<bits/stdc++.h>
using namespace std;
long long t,k,ans;
long double r;
bool f=1;
int main() {
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>t;
while(t--) {
cin>>k;
r=k+0.5;
while(floor(r)!=ceil(r)) {
r=r*ceil(r)*1.0;
ans++;
if(ans>100000000000) {
cout<<"NO!\n";
f=0;
break;
}
}
if(f) {
cout<<ans<<'\n';
f=1;
}
ans=0;
}
return 0;
}
帮本蒟蒻看看哪里不行吧,只得了15分