题意:有个邮递员,要送信,每次最多带 m 封信,有 n 个地方要去送,每个地方有x 封要送,每次都到信全送完了,再回去,对于每个地方,可以送多次直到送够 x 封为止. 析:一个很简单的贪心,就是先送最远的,如果送完最远的还剩下,那么就送次远的,如果不够了,那么就加上回来的距离,重新带够 m 封信,对于左半轴和右半轴都是独立的,两次计算就好. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include &l…
Shopping 题目连接: http://codeforces.com/gym/100803/attachments Description Your friend will enjoy shopping. She will walk through a mall along a straight street, where N individual shops (numbered from 1 to N) are aligned at regular intervals. Each shop…
题目链接:http://codeforces.com/gym/101775/problem/B Aori is very careless so she is always making troubles. One day she does it again, with N big troubles! But this time she seems to be at ease because she has found M Inklings to take all the blames. Eac…
After the data structures exam, students lined up in the cafeteria to have a drink and chat about how much they have enjoyed the exam and how good their professors are. Since it was late in the evening, the cashier has already closed the cash registe…
Gym Class Time Limit: 6000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 768 Accepted Submission(s): 309 Problem Description 众所周知,度度熊喜欢各类体育活动. 今天,它终于当上了梦寐以求的体育课老师.第一次课上,它发现一个有趣的事情.在上课之前,所有同学要排成一列, 假设最开始每个人有…
贪心的策略 #include <bits/stdc++.h> using namespace std; ; typedef long long ll; struct m { int hp,atk,num; }mon[N]; bool cmp(m a,m b) { return a.atk*b.num>b.atk*a.num;//排序的依据是被攻击的次数和攻击力的乘积 } int n; int main() { ; scanf("%d",&t); while(t…
Pavel is developing another game. To do that, he again needs functions available in a third-party library too famous to be called. There are mm functions numbered from 11to mm, and it is known that the ii-th version of the library contains functions…
[题目链接] A - Alphabet 最长公共子序列.保留最长公共子序列,剩余的删除或者补足即可. #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; char s[maxn]; char t[maxn]; int dp[100][100]; int main() { scanf("%s", s); for(int i = 0; i < 26; i ++) { t[i] =…
F. Doomsday Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/F Description Doomsday comes in t units of time. In anticipation of such a significant event n people prepared m vaults in which, as they think, it will…
题目链接: Gym Class Time Limit: 6000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem Description 众所周知,度度熊喜欢各类体育活动. 今天,它终于当上了梦寐以求的体育课老师.第一次课上,它发现一个有趣的事情.在上课之前,所有同学要排成一列, 假设最开始每个人有一个唯一的ID,从1到N,在排好队之后,每个同学会找出包括自己在内的前方所有同学的最小ID,…
Donald is a postman 题目链接: http://acm.hust.edu.cn/vjudge/contest/126546#problem/L Description Donald Duck works as a postman for the Walt Disney Studios. He delivers children's letters from all over the world to his friends, which are cartoon characte…
E. Epic Fail of a GenieTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/E Description Aladdin had found a new shiny lamp and has started polishing it with his hands. Suddenly a mysterious genie appeared from withi…
E - bits-EqualizerTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87794#problem/K Description You are given two non-empty strings S and T of equal lengths. S contains the characters 0, 1 and ?, where…
Problem H. Hell on the MarketsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86821#problem/H Description Most financial institutions had become insolvent during financial crisis and went bankrupt or…