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

两个比较 WA 和AC的

Posted by 19871026 at 2009-03-24 01:04:41 on Problem 2196 and last updated at 2009-03-24 01:23:32
#include<iostream>
using namespace std;
int main()
{
    int a,i,j,k,p,sum1,sum2,sum3;
    for(a=2992;a<10000;a++)
    {
         sum1=0;sum2=0;sum3=0;i=a;j=a;k=a;p=a;
         while(k<10)
         {
             sum1+=k%10;
             k/=10;
         }
         while(i<12)
         {
             sum2+=i%12;
             i/=12;
         }
         while(j<16)
         {
             sum3+=j%16;
             j/=16;
         }
         if((sum1==sum2)&&(sum2==sum3))
             cout<<p<<endl;
    }
    system("pause");
    return 0;
}





#include<iostream>
using namespace std;
int main()
{
    int a,i,j,k,p,sum1,sum2,sum3;
    for(a=2992;a<10000;a++)
    {
         sum1=0;sum2=0;sum3=0;i=a;j=a;k=a;p=a;
         sum1+=i%10;
         i/=10;
	     sum1+=i%10;
	     i/=10;
	     sum1+=i%10;
	     i/=10;
	     sum1+=i%10;
	     
         sum2+=j%16;
    	 j/=16;
    	 sum2+=j%16;
    	 j/=16;
    	 sum2+=j%16;
    	 j/=16;
    	 sum2+=j%16;
    	 
    	 sum3+=k%12;
    	 k/=12;
    	 sum3+=k%12;
    	 k/=12;
    	 sum3+=k%12;
    	 k/=12;
    	 sum3+=k%12;
    	 
         if((sum1==sum2)&&(sum2==sum3))
             cout<<p<<endl;
    }
    system("pause");
    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