找到bug必关!

P1047 [NOIP2005 普及组] 校门外的树

Jokersheng @ 2024-08-05 22:16:04

1AC9WA

#include <bits/stdc++.h>
using namespace std;

int n,m,s[1000005],res;

struct node{
    int l,r;
}a[10005];

int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i].l>>a[i].r;
        for(int j=a[i].l;j<=a[i].r;j++){
            s[j]++;
        }
    }
    for(int i=0;i<=n;i++){
        if(s[i]==0){
            res++;
        }
    }
    cout<<res;
}

by meifan666 @ 2024-08-05 22:19:17

@shengshengzqs m组数,第一重循环到m


by Jokersheng @ 2024-08-05 22:23:01

@meifan666

给自己整笑了(已关)


by lisaymq @ 2024-08-25 16:55:01

所以说你改名了?改成了joker


|