zoukankan      html  css  js  c++  java
  • HDU-2037 今年暑假不AC

     1 #include <bits/stdc++.h>
     2 using namespace std;
     3 
     4 #define pb push_back
     5 #define maxSize 3939
     6 #define _for(i,a,b) for(int i = (a);i < (b);i ++)
     7 
     8 struct s
     9 {
    10     int op;
    11     int ed;
    12 };
    13 
    14 bool cmp(s s1,s s2)
    15 {
    16     return s1.ed < s2.ed;
    17 }
    18 
    19 int main()
    20 {
    21     vector<s> list;
    22     int num;
    23     while(~scanf("%d",&num) && num!=0)
    24     {
    25         _for(i,0,num)
    26         {
    27             int a,b;
    28             scanf("%d %d",&a,&b);
    29             list.push_back(s{a,b});
    30         }
    31         
    32         sort(list.begin(),list.end(),cmp);
    33         
    34         int cnt = 0;
    35         cnt ++;
    36         int overtime = list[0].ed;
    37         _for(i,1,num)
    38         {
    39             if(list[i].op >= overtime)
    40             {
    41                 cnt ++;
    42                 overtime = list[i].ed;
    43             }
    44         }
    45         cout << cnt << endl;
    46         list.clear();
    47     }
    48     
    49     return 0;
    50 }
  • 相关阅读:
    day4
    day3
    day2
    day1
    spring-boot-note
    spring-boot-cli
    jquery ajax rest invoke
    spring-boot
    docker mysql
    jpa OneToMany
  • 原文地址:https://www.cnblogs.com/Asurudo/p/10565278.html
Copyright © 2011-2022 走看看