ccf 2018/09/01 买菜(只有10分,请帮忙!)

注!不知道为什么只有10分

#include<iostream>
using namespace std;
int main(){
    int n=0,**a=new int*[2000],**b=new int*[2000],*count=new int[2000];
    int i=0,j=0,x=0,y=0;
    
    for(i=0;i<2000;i++){
          a[i]=new int[10000];
          b[i]=new int[10000];
    }
    for(i=0;i<2000;i++){
        for(j=0;j<10000;j++){
            a[i][j]=0;
            b[i][j]=0;
        }
        count[i]=0;
    }
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>x>>y;
        if(x>=y)return -1;
        for(j=x;j<=y;j++)
           a[i][j]=1;    
    }
    for(i=n+1;i<=n*2;i++){
        cin>>x>>y;
        if(x>=y)return -1;
        for(j=x;j<=y;j++)
           a[i][j]=1;    
    }
    for(i=1;i<=n;i++){
        for(j=0;j<100;j++){
           if(a[i][j]==a[n+i][j]&&a[i][j]==1){
            count[i]++;
            }
        }
        if(count[i]>1){
            count[i]=count[i]-1;
        }
        else{
            count[i]=0;
        }
    }
    for(i=0;i<2000;i++){
        count[0]+=count[i];
    }
cout<<*count;

    return 0;
}

相关文章:

  • 2021-11-04
  • 2021-11-28
  • 2022-01-15
  • 2021-08-22
  • 2021-11-17
  • 2021-08-31
  • 2021-10-07
  • 2021-09-01
猜你喜欢
  • 2022-12-23
  • 2021-08-24
  • 2022-02-18
  • 2021-07-31
  • 2021-08-19
  • 2021-05-29
  • 2022-12-23
相关资源
相似解决方案