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

郁闷啊,我觉得没错的代码怎么wrong answer了

Posted by zjut020 at 2008-11-20 12:10:47 on Problem 2603
#include<iostream>
#include<fstream>

using namespace std;

int main()
{
  //ifstream cin("0000.txt");
    int prime[1500];
    prime[0]=2;int q=0;
    int i;
    for(i=3;i<10000;i++)
    {
        int zz=1;
        for(int j=0;prime[j]*prime[j]<=i;j++)
        if(i%prime[j]==0)
        {zz=0;break;} 
        if(zz)prime[++q]=i; 
    }
    int sum1=1;
    int n;
    int p[1500];
    for(i=0;i<q;i++)
    p[i]=0;
    for(i=0;i<10;i++)
    {
           cin>>n;
           for(int k=0;k<q&&n!=1;k++)  
           {
               while(n%prime[k]==0)
               {
                  p[k]++; 
                  n/=prime[k];
               }  
           }
    } 
    for(i=0;i<q;i++)
    if(p[i])
    sum1=sum1%10*(p[i]+1)%10;
    cout<<sum1%10<<endl;
    //system("pause");
    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