萌新刚学OI几天,求助

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

样例输出152
by 凑智花 @ 2019-04-11 18:03:38


说实话您的神仙代码没看懂qwq
by Jelly_Goat @ 2019-04-11 18:05:08


终于遇到个说实话的__萌新
by ZORO @ 2019-04-11 18:10:54


额,我......
by 凑智花 @ 2019-04-11 18:12:29


~~这次是真萌新~~
by z_Y_r @ 2019-04-11 18:15:55


话说这题咋做
by 凑智花 @ 2019-04-11 18:19:18


抄了题解的我又错了 ```cpp #include <stdio.h> #include <string.h> int l, m, ans = 0; int a[10001]; int main() { memset(a, 0, sizeof(a)); scanf("%d%d", &l, &m); for (int i = 1; i <= m; i++) { int x, y; scanf("%d%d", &x, &y); for (int j = x; j <= y; j++) { a[j]++; } } for (int i = 1; i <= l; i++) { if (a[i] != 0) ans++; } printf("%d\n", ans); return 0; } ```
by 凑智花 @ 2019-04-11 18:21:41


```cpp #include<iostream> using namespace std; int a[10005],b,c; int main() { int L,M,ANS=0; cin>>L>>M; for(int i=1;i<=M;i++) { cin>>b>>c; for(;b<=c;b++) a[b]=1;//设置为真 } for(int i=0;i<=L;i++) { if(a[i]==0) ANS++; } cout<<ANS; return 0; }
by 灵光一闪 @ 2019-04-11 18:21:58


~~这几天天天见咕值前十的萌新~~
by 小塘空明 @ 2019-04-11 18:23:04


………………
by AC自动机_ @ 2019-04-11 18:23:33


| 下一页