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

不打表直接计算也是0秒啊。。

Posted by bingshen at 2010-09-16 20:27:57 on Problem 2196
#include<stdio.h>
#include<string.h>

bool judge(int n)
{
	int ten=0,tew=0,six=0;
	int num1=0,num2=0,num3=0;
	int temp=n;
	while(temp)
	{
		ten=ten+temp%10;
		temp=temp/10;
	}
	temp=n;
	while(temp)
	{
		tew=tew+temp%12;
		temp=temp/12;
	}
	temp=n;
	while(temp)
	{
		six=six+temp%16;
		temp=temp/16;
	}
	if(ten==tew && ten==six)
		return true;
	else
		return false;
}

int main()
{
	int i;
	for(i=1000;i<10000;i++)
	{
		if(judge(i))
			printf("%d\n",i);
	}
	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