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 |
sum10=0; sum12=0; sum16=0;这个应该放在循环里面In Reply To:请帮忙,为什么不行? 郁闷,看n年了,都看不出 Posted by:wurongxin at 2006-10-23 02:07:45 > #include<iostream.h> > > int main(){ > int sum10, sum12, sum16; > sum10=0; sum12=0; sum16=0; > for(int i=2992; i<10000; i++){ > int x; > x=i; > sum10 += x%10; > x /= 10; > sum10 += x%10; > x /= 10; > sum10 += x%10; > x /= 10; > sum10 += x%10; > > x=i; > sum12 += x%12; > x /= 12; > sum12 += x%12; > x /= 12; > sum12 += x%12; > x /= 12; > sum12 += x%12; > > x=i; > sum16 += x%16; > x /= 16; > sum16 += x%16; > x /= 16; > sum16 += x%16; > x /= 16; > sum16 += x%16; > > if((sum10 == sum12) && (sum12 == sum16)) cout<<i<<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