Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:为什么老wa,很无语啊!!求高手指教(贴代码)In Reply To:为什么老wa,很无语啊!!求高手指教(贴代码) Posted by:jean890915 at 2011-10-09 20:37:21 > #include "iostream" > #include "math.h" > using namespace std; > > int main() > { > int i,n,sum; > > cin>>n; > cout<<"PERFECTION OUTPUT"<<endl; > while (n!=0) > { > sum = 0; > for (i=2;i<=(int)sqrt(1.0*n);i++) > { > if (n%i == 0) > { > sum += i; > if (i != n/i) > sum += n/i; > } > } > if (n!=1) > sum += 1; > if (sum == n) > printf("%5d PREEFCT\n",n);%这里perfect写错了!!!无语!!!!!!!!! > else if (sum < n) > printf("%5d DEFICIENT\n",n); > else > printf("%5d ABUNDANT\n",n); > cin>>n; > } > cout<<"END OF OUTPUT"<<endl; > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator