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

为什么老是不对呀?高手帮忙看看:

Posted by kikif at 2007-08-28 21:24:04 on Problem 3331
#include <stdio.h>
#include <iostream>
#include <fstream>
using namespace std;

void main(){
	int testcase;
	cin>>testcase;
	for(int i=0;i<testcase;i++){
		int n,p;
		cin>>n>>p;
		__int64 mult=1;
		for(int j=1;j<=n;j++)
			mult=mult*j;
	//	printf("%I64d\n",mult);
		int pn=0;
		while(mult%10==0){
			if(p==0)pn++;
			mult=mult/10;
		}
		while(mult>0){
			__int64 ss=mult/10;
			__int64 tmp=mult-ss*10;
			if(tmp==p)pn++;
			mult=ss;
		}
		cout<<pn<<endl;
	}
}

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