| ||||||||||
| 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 | |||||||||
Why WA?#include <stdio.h>
short N, M;
int main (){
int i, u, t, f;
while ( scanf ( "%d", &N ) ){
if (N==-1) break;
for (t=f=0, i=M=1; i<=N; i++){
u=i;
while ( u%2==0 ) u/=2, t++;
while ( u%5==0 ) u/=5, f++;
u%=10, M*=u, M%=10;
}
t-=f;
while ( t-- ) M*=2, M%=10;
printf ( "%5d -> %d\n", N, M );
N=-1;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator