CodeFoeces-479C

题目

原题链接:C. Exams

题意

瓦力学习很好,现在他需要进行期末考试。有n门课,每一门考试时间为ai,和一个提前时间bi,他必须按ai的顺序考,在满足顺序的前提下可以在bi天考。贪心,能在bi天考最好,不行就ai

代码

#include
using namespace std;
struct node{
    int a,b;
}s[5000];
int cmp(node a,node b){
    if(a.a==b.a) return a.b=ans){
            ans+=s[i].b-ans;
        }else if(s[i].a>ans){
            ans+=s[i].a-ans;
        }
    }
    printf("%d\n",ans);
    return 0;
}

你可能感兴趣的:(CodeFoeces-479C)