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

Re:为什么老是超时间了????

Posted by changzhiwin at 2007-12-01 23:22:48 on Problem 1338
In Reply To:为什么老是超时间了???? Posted by:2147483648 at 2007-09-24 12:03:02
>   我的程序是::::
> 
> #include<iostream>
> using namespace std;
> int main()
> {
> 	long int num[1500];
> 	long int a,b;
> 	int k;
> 	for( k = 1 ; k < 7 ;k++)
> 		num[k] = k;
> 	for( a = 7 ; a <= 2147483648 ; a++)
> 	{
> 		  b = a;
> 	      while( b % 2 == 0)
> 		  {
> 		       b /= 2;
> 		  }
> 		  while( a % 3 == 0)
> 		  {
> 		      b/=3;
> 		  }
> 		  while( a % 5 == 0)
> 		  {
> 		       b /= 5;
> 		  }
> 		  if( b == 0)num[k++] = a;
> 	}
> 	for( int x = 0; x < 1500 ; x++)
> 		cout << num[x]<<" ";
> 	cout << endl;
> 	int i;
> 	while( cin >> i && i)
> 	{
> 	      cout << num[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