题意:给定 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; +…
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…
CodeForces 474B Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Description 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 co…
Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Halloween computer game. The game is played on a rectangular graveyard with a rectangular chapel in it. During the game, the player places new rectangul…
题目链接:http://codeforces.com/problemset/problem/705/A 从第三个输出中可看出规律, I hate that I love that I hate it I hate I love 是来回循环的,不到最后一个每一次循环后面都输出 that,如果到最后则输出 it #include<bits/stdc++.h> using namespace std; int main() { ][]= {"I love ","I ha…
题意:给定两个速度,一个一初速度,一个末速度,然后给定 t 秒时间,还每秒速度最多变化多少,让你求最长距离. 析:其实这个题很水的,看一遍就知道怎么做了,很明显就是先从末速度开始算起,然后倒着推. 代码如下: #include <bits/stdc++.h> using namespace std; typedef long long LL; const int maxn = 1e5 + 5; const int INF = 0x3f3f3f3f; vector<int> ans;…