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
北京大学《ACM/ICPC大学生程序设计竞赛训练》暑期课面向全球招生!

输出的是约数个数的最后一位。。

Posted by wpolly at 2007-03-08 13:50:51 on Problem 2603
In Reply To:怎么老错了? Posted by:acm_bug at 2006-10-04 09:02:21
> #include<iostream>
> #include<stdio.h>
> #include<string.h>
> using namespace std;
> int b[10000];
> int main()
> {
>     int a,c,i;
>     memset(b,0,10000);
>     for(i=0;i<10;++i)
>     {
>        cin>>c;  a=c;
>        if(a==2)b[2]++;
>        else if(a==3)b[3]++;
>        else if(a>=4)
>        for(int j=2;j<=c/2;++j)
>        {
>             
>             while((a%j)==0)
>             {a/=j;b[j]++;}
>             if(a==1)break;
>        }
>     }
>     long long num=1;
>     for(int i=0;i<10000;++i)
>     if(b[i])num*=(b[i]+1);
>     cout<<num<<endl;
>     getchar();
>     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