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 |
求查错。。#include<iostream> using namespace std; int cases; int n; int a[10000005] = {0}; bool used[10005]; int s,e; int main() { int i,j; cin>>cases; while(cases--) { memset(used,0,sizeof(used)); memset(a,0,sizeof(a)); int ans = 0; cin>>n; for(i = 1;i <= n;++i) { scanf("%d%d",&s,&e); for(j = s;j <= e;++j) a[j] = i; } for(i = 1;i <= 10000005;++i) { if(a[i] == 0)continue; if(used[a[i]] == 0) { ans ++; used[a[i]] = 1; } } printf("%d\n",ans); }//end of while return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator