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

Re:为什么0和1都少一个呢。。 不知道哪错了 哪位大牛帮忙看看啦

Posted by BrainDeveloper at 2009-07-21 00:54:50 on Problem 3720
In Reply To:为什么0和1都少一个呢。。 不知道哪错了 哪位大牛帮忙看看啦 Posted by:Brdy0013 at 2009-06-24 15:06:29
> #include <stdio.h>
> #include <string.h>
> int occur[101][10];
> int main(){
> 	
> 	bool v[100];
> 	for(int i=2;i<101;++i){
> 		memset(v,0,sizeof(v));
> 		int t=1;
> 		while((t%=i)&&!v[t]){
> 			v[t]=1;
> 			t*=10;
> 			occur[i][t/i]++;
> 		}
> 	}
> 	int n,k,ret=0;
> 	while(scanf("%d%d",&n,&k)!=EOF){
> 		ret=0;
> 		for(int i=2;i<n;++i) ret+=occur[i][k]; // 把这句改成 i<=n 就对了
> 		printf("%d\n",ret);
> 	}
> 	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