ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1352. Mersenne Primes

0.001 vs 0.015
Posted by AB&B 2 May 2007 01:47
This code get 0.001
int main()
{
    int n, i, k,
        m[]={ 0, here must be numberz :) };  // 39 numbers
    scanf("%d",&k);
    for(i=0;i<k;i++)
    {
        scanf("%d",&n);
        printf("%d\n",m[n]);
    }
    return 0;
}

and this code get 0.015
int main()
{
    int n, i, k,
        m[]={here must be numberz :) };  // 38 numbers
    scanf("%d",&k);
    for(i=0;i<k;i++)
    {
        scanf("%d",&n);
        printf("%d\n",m[n-1]);
    }
    return 0;
}


Why 38 iterations of (n-1) so hardly influence for speed of execution ???

Edited by author 02.05.2007 01:47
Re: 0.001 vs 0.015
Posted by Oleg 30 Jun 2010 11:29
It is not a problem of time, your program is good.You have different time because the server was checking another solution with yours