A. Exams Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/480/problem/A Description Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly n exams. Valera…
题意:给\(n\)场考试的时间,每场考试可以提前考,但是记录的是原来的考试时间,问你如何安排考试,使得考试的记录时间递增,并且最后一场考试的时间最早. 题解:因为要满足记录的考试时间递增,所以我们用结构体记录两个时间,并按第一个时间排序,然后遍历考试时间,\(ans\)记录上次考试的时间,我们每次将两个时间和\(ans\)比一下,如果提前考试的时间比\(ans\)小,说明我们一定不能提前考试(因为时间已经晚了),否则就提前考掉. 代码: struct misaka{ int a,b; bool…
http://codeforces.com/contest/479/problem/C C. Exams time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Student Valera is an undergraduate student at the University. His end of term exams are…
http://codeforces.com/contest/732/problem/D 这题我发现很多人用二分答案,但是是不用的. 我们统计一个数值all表示要准备考试的所有日子和.+m(这些时间用来考试) 那么这个all值就是理想的最小值.然后去前all个数找,贪心地复习最小的科目,然后有的考试的话,就优先考试. 如果经过这all天,复习完了(这个是肯定得),但是只是因为时间分配不好,导致没得考试(数据导致没得考试) 那么就暴力枚举后面的[all + 1, n].有得考试就去考试,刚好考完就直…
Codeforces Round #377 (Div. 2) D. Exams    题意:给你n个考试科目编号1~n以及他们所需要的复习时间ai;(复习时间不一定要连续的,可以分开,只要复习够ai天就行了)   然后再给你m天,每天有一个值di; 其中,di==0代表这一天没有考试(所以是只能拿来复习的); 若di不为0,则di的值就代表第i天可以考编号为di的科目 ;(当然这一天也可以不考而拿来复习) .  问你最少能在第几天考完所有科目,无解则输出-1. 题解:首先,先想想最暴力的方法:从…
A. Mafia Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/348/problem/A Description One day n friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other n - 1…
题目地址:http://codeforces.com/contest/479 这次自己又仅仅能做出4道题来. A题:Expression 水题. 枚举六种情况求最大值就可以. 代码例如以下: #include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include &…
B. Urbanization 题目链接 http://codeforces.com/contest/735/problem/B 题面 Local authorities have heard a lot about combinatorial abilities of Ostap Bender so they decided to ask his help in the question of urbanization. There are n people who plan to move…
题目链接: http://codeforces.com/problemset/problem/268/E E. Playlist time limit per test 1 secondmemory limit per test 256 megabytes 问题描述 Manao's friends often send him new songs. He never listens to them right away. Instead, he compiles them into a play…
A http://codeforces.com/contest/479/problem/A 枚举情况 #include<cstdio> #include<algorithm> using namespace std; int main(){ int a,b,c; while(~scanf("%d%d%d",&a,&b,&c)){ ; ans=max(ans,a+b+c); ans=max(ans,a*b*c); ans=max(ans,a…