Link: http://tioj.ck.tp.edu.tw/problems/1851 基本上就是求N有幾個因數,如果有偶數個輸出no,奇數個輸出yes由於因數是兩兩成對的,所以只要判斷n是不是一個完全平方數即可 AC code 123456789101112131415161718 #include<cmath>using namespace std;int (){ ios::sync_with_stdio(0); cin.tie(0); unsigned n; while(cin>>n,n) { unsigned t=sqrt(n); if(t*t==n) cout<<"yesn"; else cout<<"non"; }} 赞微海报分享
近期评论