A. Valera and X time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn…
链接:http://codeforces.com/contest/404/problem/B B. Marathon time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera takes part in the Berland Marathon. The marathon race starts at the stadium…
链接:http://codeforces.com/contest/404/problem/A A. Valera and X time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera is a little boy. Yesterday he got a huge Math hometask at school, so Va…
B. Valera and Fruits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Valera loves his garden, where n fruit trees grow. This year he will enjoy a great harvest! On the i-th tree bi fruit gr…
题目:http://codeforces.com/contest/404/problem/B #include <iostream> #include <cstring> #include <cstdio> #include <cstdlib> #include <algorithm> using namespace std; int main() { __int64 g; //g一定要是长整形,因为数据会超int.这个也是错误的最主要原因 in…
链接 A. Valera and X time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard output Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn…
题目链接:http://codeforces.com/contest/369/problem/D 注意题意:所有fools都向编号最小的fool开枪:但每个fool都不会笨到想自己开枪,所以编号最小的fool向编号次小的fool开枪: 所以只需记录编号最小的两位成员即可代表一种状态:当然当只剩一个fool时,次小编号是不存在的出界元素. 编号最小的两个fools只有四种状态:a活b活,a死b死,a活b死,a死b活:注意状态转移条件. 记忆化搜索即可(算法上依然是搜索的流程,但是搜索到的一些解用动…
贪心算法,每条路径最短2格,故前k-1步每次走2格,最后一步全走完 由于数据比较小,可以先打表 #include <iostream> #include <vector> #include <algorithm> #include <utility> using namespace std; typedef pair<int,int> Point; int main(){ ; cin >> n >> m >>k…
#include <iostream> #include <vector> #include <algorithm> #include <map> using namespace std; int main(){ int n,v; cin >> n >>v; map<int,int> fruit; ; i < n; ++ i ){ int a,b; cin >>a >> b; if(fruit…
水题 #include <iostream> #include <set> #include <vector> #include <algorithm> using namespace std; int main(){ int n,v; cin >> n >> v; vector<int> res; ; i < n; ++ i){ int k,s; bool flag = false; cin >> k;…