| ||||||||||
| 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 | |||||||||
Re:为什么0和1都少一个呢。。 不知道哪错了 哪位大牛帮忙看看啦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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator