Worms】的更多相关文章

B. Worms time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch. Marmot brought Mole n ordered piles of worms such…
http://codeforces.com/problemset/problem/474/B B. Worms time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch. Ma…
It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch. Marmot brought Mole n ordered piles of worms such that i-th pile contains ai worms. He labeled all these worms with consecutive integers: worms in first pile are label…
474B Worms time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch. Marmot brought Mole n ordered piles of worms su…
题目链接:http://codeforces.com/contest/474/problem/B 解题报告:给你n个堆,第i个堆有ai个物品,物品的编号从1开始,第一堆的编号从1到a1,第二堆编号从a1+1到a1+a2.......,现在有m次查询,给你一个编号,让你求出这个编号的物品在第几个堆. 离线算法,先把m次查询按照编号从小到大排序,然后全部求出来之后按照输入的顺序排序就行了. #include<cstdio> #include<cstring> #include<i…
题意:一条直线上有n个炸弹,给出每个炸弹的爆炸半径,可以引爆另一个炸弹爆炸.问:每个炸弹爆炸后,最多有几个炸弹一起爆炸? 迭代,用线段树更新. #include <cstdio> #include <algorithm> #include <iostream> #define ll long long #define lson l, m, rt<<1 #define rson m+1, r, rt<<1|1 #define X first #de…
主题链接:http://codeforces.com/contest/474/problem/B #include <iostream> #include <cmath> #include <algorithm> #include <cstdio> using namespace std; template <class T> inline bool rd(T &ret) { char c; int sgn; if(c=getchar()…
求出爆炸点的坐标,就成了多边形与圆相交面积的模板题了... #include<algorithm> #include<iostream> #include<cstring> #include<fstream> #include<sstream> #include<vector> #include<string> #include<cstdio> #include<bitset> #include&l…
题意:给定 n 堆数,然后有 m 个话询问,问你在哪一堆里. 析:这个题是一个二分题,但是有一个函数,可以代替写二分,lower_bound. 代码如下: #include<bits/stdc++.h> using namespace std; typedef long long LL; const int maxn = 1e5 + 5; int a[maxn]; int main(){ int n, m; cin >> n; for(int i = 1; i <= n; +…
pro:开始有一个字母虫,然后字母虫在每一天可以选择自己身上的部分字母变换,变换规则形如A->BC. 现状给定最终字母虫的字符串,求最少用了多少天. 如有规则A->BC,B->AC,C->AB:则ACAB可以见过三天(A-BC-ACC-ACAC)或者两天(A-BC-ACAB)得来. 规则不超过80,字符串长度不超过50: sol:dp[i][j][p]表示,最开始只有字母p,变换到[i,j]区间的最小天数. 显然初始:dp[i][i][x]=c[i]==x?0:inf; 其他:  …