| ||||||||||
| 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 | |||||||||
ft,改的根本就不是地方……是下面!cout<<result前面那里,继续好好想想In Reply To:现在改了, 位身莫还是不对呢? Posted by:shasha at 2005-04-26 22:43:38 > #include<iostream.h>
> int isequal(int *, int *, int );
> int unempty(int *, int );
> int main(){
> int p,t,pp,tt,result=0;
> int a[100][100];
> for(int i=0; i<100; i++)
> for(int j=0;j<100;j++)
> a[i][j]=0;
> cin>>p>>t;
>
> while(cin>>pp>>tt){
>
> a[pp-1][tt-1]=1;
> }
> for(i=0; i<100; i++){
> if(unempty(a[i],100)){
> for(int j=i+1; j<100; j++)
> if(isequal(a[i],a[j],100)){
> for(int m=0; m<100; m++)
> a[j][m]=0;
> }
> }
> }
>
> for(i=0; i<100; i++){
> for(int j=0; j<100;j++)
> if(a[i][j]!=0){
> result++;
> break;
> }
> }
>
>
> cout<<result<<endl;
> return 0;
> }
>
> int isequal (int *a,int *b,int n){
> for(int i=0;i<n;i++)
> if(a[i]!=b[i])
> return 0;
>
> return 1;
>
> }
>
> int unempty(int * a,int num){
> for(int i=0; i<num; i++)
> if(a[i]!=0)
> return 1;
>
> return 0;
>
> }
>
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator