A. Uncowed Forces Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/problem/A Description Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maxi…
B. More Cowbell time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass inst…
B. More Cowbell Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/problem/B Description Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of co…
https://codeforces.com/contest/1121/problem/F 题意 给你一个有n(<=5000)个字符的串,有两种压缩字符的方法: 1. 压缩单一字符,代价为a 2. 压缩一个串,条件是这个串是前面整个串的连续子串,代价为b 题解 n<=5000 定义dp[i]为压缩前i个字符的代价,则答案为dp[n] dp[i]=min(dp[i-1]+a,min(dp[j]+b)(即[j+1,i]为[1,j]的子串)) 用字符串哈希处理判定一个串是否为前面的子串 坑点 串ab…
题意与分析(CodeForces 604B) 题意是这样的:\(n\)个数字,\(k\)个盒子,把\(n\)个数放入\(k\)个盒子中,每个盒子最多只能放两个数字,问盒子容量的最小值是多少(水题) 不要看到这种题目什么都不想,看见最大容量最小值就是起手一个二分,这题运用贪心的思想会更简单. 想一想紫书上有一题是类似的,两个人坐船过河的,也是同样的思路. 我们一定要注意到这样一个结论:如果第一个数没法和某一个数放在一起,那么大于等于它的数一定都只能一个单独的盒子了.设这个数是第\(p\)个,那么就…
#include<bits/stdc++.h>using namespace std;const long long N=1e5+5;const long long MOD=1e9+7;long long n,x,y,ans=0;long long cost[N];pair<long long,long long>a[N];multiset<pair<pair<long long,long long>,long long> >s;int main…
D. Exams Problem Description: Vasiliy has an exam period which will continue for n days. He has to pass exams on m subjects. Subjects are numbered from 1 to m. About every day we know exam for which one of m subjects can be passed on that day. Perhap…
水 A - Uncowed Forces #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5 + 5; const int INF = 0x3f3f3f3f; int main(void) { int s[5] = {50, 100, 150, 200, 250}; int m[5], w[5], hs, hu; for (int i=0; i<5; ++i) { sc…
D. Exams time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy has an exam period which will continue for n days. He has to pass exams on m subjects. Subjects are numbered from 1 to m. Ab…
D. Moodular Arithmetic Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/problem/D Description As behooves any intelligent schoolboy, Kevin Sun is studying psycowlogy, cowculus, and cryptcowgraphy at the Bovinia State Uni…