| ||||||||||
| 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 | |||||||||
为什么老是超时间了???? 我的程序是::::
#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator