string的头文件是string,不是string.h
by czx6666 @ 2024-03-26 11:33:40
@[cy156](/user/1274005)
by czx6666 @ 2024-03-26 11:33:54
```
#include<bits/stdc++.h>
using namespace std;
struct t
{
int a;
int b;
};
bool cmp(t x,t p){
return x.b<p.b;
}
int main()
{
t sj[10001];
int n,t;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>sj[i].a>>sj[i].b;
}
sort(sj,sj+n,cmp);
int mark=0;
int count=1;
for(int i=0;i<n;i++)
{
if(sj[i].a>mark)
{
count++;
mark=sj[i].b;
}
}
cout<<count;
return 0;
}
```
by czx6666 @ 2024-03-26 11:40:11
[std::time](https://zh.cppreference.com/w/cpp/chrono/c/time)
应该是和 `std::time` 撞了。
应该把 `struct time` 声明放上面,并且全部使用 `struct time` 来定义对应的变量。
或者你可以选择换一种命名方式,像 `time`、`next`、`size` 等等这样的命名尽量不要在 `using namespace std;` 在全局出现的时候使用。
by Terrible @ 2024-03-26 11:51:18
@[Terrible](/user/195942) 好的,感谢大佬
by cy156 @ 2024-03-26 12:52:48