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

Why WA?

Posted by songuno1 at 2006-02-05 23:57:57 on Problem 1604
#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:
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