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:晕~就因为c【】太小了~改1000就过了~~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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator