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 |
这个不是费马大定理吧In Reply To:用 费马大定理 失败,这里的数据有重,一个人可以两次听到一棵树 Posted by:yuanyirui at 2007-03-30 16:32:06 > #include <stdio.h> > #include <iostream> > using namespace std; > int main() > { > // freopen("in.txt","r",stdin); > // freopen("out.txt","w",stdout); > int p,n; > int s[100],i,a,b,tmp,ans; > scanf("%d%d",&p,&n); > for(i=1;i<=p;i++) s[i]=0; > while(scanf("%d%d",&a,&b)!=EOF){ > s[a] += b*b*b; //如果数据不出现重复,把多维映射到一维就没有问题 > } > sort(s+1,s+p); > ans=0; > for(i=1,tmp=-1;i<=p;i++){ > if(s[i]>tmp){ > tmp=s[i]; > ans++; > } > } > printf("%d\n",ans); > return 1; > } 即使没有重复这个也是错的吧,还有,这个不是费马大定理吧 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator