# HDU 2037 今年暑假不AC【贪心】

2021-07-20 03:52:31 李响Superb

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 69312 Accepted Submission(s): 37245

Problem Description
“今年暑假不AC？”
“是的。”
“那你干什么呢？”
“看世界杯呀，笨蛋！”
“@#\$%^&*%…”

Input

Output

``````Sample Input
12
1 3
3 4
0 7
3 8
15 19
15 20
10 15
8 18
6 12
5 10
4 14
2 9
0

Sample Output
5
```

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
```

``````#include <stdio.h>
int main()
{
int a[100][2], b[100], count, temp, t, n;
while ( scanf("%d",&n) && n != 0 )
{
int i, j;
for (i = 0; i < n; i++)
for (j = 0; j < 2; j++)
scanf("%d",&a[i][j]);
//按结束时间排序
for (i = 0; i < n; i++)
for (j = 0; j < n-1-i; j++)
{
if (a[j][1] > a[j+1][1] )
{
t = a[j][1];
a[j][1] = a[j+1][1];
a[j+1][1] = t;
temp = a[j][0];
a[j][0] = a[j+1][0];
a[j+1][0] = l;
}
}
count = 1, b[count] = a[0][1];
for (i = 0; i < n-1; i++)
{
if (a[i+1][0] >= b[count])
{
count++;
b[count] = a[i+1][1];
}
}
printf("%d\n",count);
}
return 0;
}
```

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
```

https://blog.51cto.com/u_14013325/2891950