Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

请帮忙,为什么不行? 郁闷,看n年了,都看不出

Posted by wurongxin at 2006-10-23 02:07:45 on Problem 2196
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator