编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#81014 | #1110. JM的算命之术 | Compile Error | 0 | 0 ms | 0 K | C++ 17 / 504 B | 15291309895 | 2022-08-10 13:29:00 |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7;
struct A {
int l, r;
} strick[MAXN];
bool cmp(A x, A y) { return x.l < y.l; }
int n, ans, tmp;
int main() {
cin >> n;
for (int i = 0; i < n; i++) cin >> strick[i].l >> strick[i].r;
sort(strick, strick + n, cmp);
for (int i = 0; i < n; i++) {
int cnt = 0;
if (strick[i].l > tmp) {
tmp = strick[i].r;
ans++;
}
}
cout << ans return 0;
}
编译信息
/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:20:16: error: expected ';' before 'return'
20 | cout << ans
| ^
| ;
21 | return 0;
| ~~~~~~