#3050: 哪裡有錯??請幫我解答一下


cedric164 (阿檊)


#include<stdio.h>
long long b(int x){
    long long c,d;
    for(c=1,d=1;c<=x;c++){d=d*c;}
    return d;
    }

main(){
    int a;
    while(scanf("%d",&a)!=EOF){
        printf("%I64d\n",b(a));
    }
}

#3053: Re:哪裡有錯??請幫我解答一下


example (學姊)


#include
long long b(int x){
    long long c,d;
    for(c=1,d=1;c<=x;c++){d=d*c;}
    return d;
    }

main(){
    int a;
    while(scanf("%d",&a)!=EOF){
        printf("%I64d\n",b(a));
    }
}

 把紅字部分修改為 %lld 就可以了

 在電腦上可以用 %I64d 測試

 但解題時要改回 %lld

 這算是 ZeroJudge 上比較奇怪的地方