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 |
不打表直接计算也是0秒啊。。#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator