这题测试点太水了,样例都没过,莫名其妙就AC了。
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int cnt=0; while(n>0){ n-=(int)(sqrt(n))*(int)(sqrt(n)); cnt++; } cout<<cnt; return 0; }
样例输出2,我的代码输出3