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:printf("Sample Output %d\n",p); 这句是不用的In Reply To:求救,各位帮忙看看我到底哪里错了。提供的数据都能够得到正确的啊! Posted by:duanxian0621 at 2010-11-01 20:33:01 > #include<stdio.h> > #include<string.h> > #define maxn 1000005 > > int q[maxn],a[maxn],x[maxn],map[maxn]; > int main() > { > int n,i,p=0; > while(scanf("%d",&n)!=EOF) > { > p++; > memset(map,0,sizeof(map)); > > for(i=0;i<n;i++) > scanf("%d%d%d",&q[i],&a[i],&x[i]); > > int sum=0,count=0; > for(i=0;i<n;i++) > { > if(a[i]) > { > map[q[i]]++; > if(map[q[i]]>1) > sum+=10; > if(x[i]) > sum+=40; > else > sum+=20; > } > > else > sum+=10; > } > printf("Sample Output %d\n",p); > printf("%d\n",sum); > } > > return 0; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator