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 |
大家帮我看看了,我咋看我的都不错#include<iostream> using namespace std; int main() { int a[7]; int b[7]; int c[7]; int i,sum,sumc; for(i=1;i<7;i++) a[i]=i*i; while(1) { sum=0; for(i=1;i<7;i++) { cin>>b[i]; sum=sum+b[i]*a[i]; } cout<<sum<<endl; if(sum==0) break; else { for(i=6;i>=1;i--) { c[i]=sum/a[i]; cout<<c[i]<<" "; sum=sum-c[i]*a[i]; if(sum==0) break; } } cout<<endl; sumc=0; for(i=1;i<7;i++) sumc+=c[i]; cout<<sumc; cout<<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