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 |
help!!!!!!!!!!!!!!!!!!!!!!!#include<iostream.h> int main() { int t,p; cin>>p>>t; int i; int j; int a[100][100]={0}; int b[100]={0}; while(cin>>i>>j) { for(int q=0;q<b[i];q++) { if(a[i][q]==j) continue; } a[i][b[i]]=j; b[i]++; } for(int k=1;k<=p;k++) { if(a[k][0]==0) continue; for(int x=k+1;x<=p;x++) { if(a[x][0]==0) continue; int num=0; for(int y=0;y<t;y++) { if(a[k][y]==0) break; int count=0; for(int z=0;z<t;z++) { if(a[k][y]==a[x][z]) { count=1; break; } } if(count==0) { num=1; break; } } if(num==0) a[x][0]=0; } } int no=0; for(int s=1;s<=p;s++) if(a[s][0]!=0) no++; cout<<no<<endl; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator