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:晕~就因为c【】太小了~改1000就过了~~

Posted by thomas_wu at 2008-11-11 19:38:55 on Problem 1218
In Reply To:虽然这个方法比较麻烦~但想知道why wa~ Posted by:thomas_wu at 2008-11-11 19:29:57
> #include<iostream>
> using namespace std;
> 
> int main()
> {
>     int i,j,a[101]={0};
>     for(i=1;i<101;i++)for(j=1;j<=i;j++)if(i%j==0)a[i]=a[i]+1;求每数因数个数
>     int b[101]={0};  
>     for(i=1;i<101;i++)b[i]=b[i-1]+(a[i]%2); 求<=i且因数数为奇的数的个数  
>     
>     int k,c[101]={0};
>     cin >>k;
>     for(i=0;i<k;i++)cin >>c[i];
>     for(i=0;i<k;i++)cout <<b[c[i]]<<endl;
>     cin >>i;
> }

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