Gym - 100637B Lunch 规律】的更多相关文章

题意:n个点,给定起点和终点,可以每次可以走一格或两格,走一格则需要一个代价,每个格子只能走一次,问从起点到终点并经过每一个点的最小代价 思路:这题我没看出什么道理,先打了个暴力,结果发现了个相当坑的规律,,然后就过了. #include <iostream> #include <cstdio> #include <fstream> #include <algorithm> #include <cmath> #include <deque&…
题意:在一条狭窄的沼泽上有一列数量为n的连续荷叶,编号为1-n.有一只蛤,在边s号荷叶上,其他荷叶上苍蝇,哈可以跳到相邻的荷叶上,或者越过一片荷叶,跳完以后原来的荷叶会沉,目标是f荷叶,在跳到f荷叶之前要吃掉其他所有的苍蝇.在这个前提下,希望尽量少跳相邻的荷叶,输出跳相邻荷叶的次数. 题解:分析先考虑一般情况 s和f把区间分成了三段,首先看左区间.由于不可能跳过连续两片荷叶,那么最后一定是要落在s左边相邻的位置上,那么对于左边的区间等效为一个子问题: 右区间和左边是对称的,情况类似, 如果左区间…
B. Lunch Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100637/problem/B Description The swamp looks like a narrow lane with length n covered by floating leaves sized 1, numbered from 1 to n with a fly sitting on the top of ea…
传送门:点我 Time limit2000 ms Memory limit262144 kB Recently Monocarp has created his own mini-laboratory! The laboratory contains nn bacteria. Monocarp knows that he can merge any two bacteria having equal sizes, and the resulting bacterium will have the…
题意: 给出正整数n和k,计算j(n, k)=k mod 1 + k mod 2 + k mod 3 + - + k mod n的值,其中k mod i表示k除以i的余数.例如j(5, 3)=3 mod 1 + 3 mod 2 + 3 mod 3 + 3 mod 4 + 3 mod 5=0+1+0+3+3=7 分析: K对根号k之后的值取模会有相同的商出现,且具有相同的商的余数呈等差数列. #include <bits/stdc++.h> using namespace std; typede…
Another Rock-Paper-Scissors Problem 题目连接: http://codeforces.com/gym/100015/attachments Description Sonny uses a very peculiar pattern when it comes to playing rock-paper-scissors. He likes to vary his moves so that his opponent can't beat him with hi…
A. Hanoi tower Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100114 Description you the conditions of this task. There are 3 pivots: A, B, C. Initially, n disks of different diameter are placed on the pivot A: the smallest dis…
题目链接:http://codeforces.com/gym/101981/attachments The use of the triangle in the New Age practices seems to be very important as it represents the unholytrinity (Satan, the Antichrist and the False Prophet bringing mankind to the New World Order with…
Ball Painting 题目连接: http://codeforces.com/gym/100015/attachments Description There are 2N white balls on a table in two rows, making a nice 2-by-N rectangle. Jon has a big paint bucket full of black paint. (Don't ask why.) He wants to paint all the b…
BOPCTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86686#problem/D Description You invented a new chess figure and called it BOPC. Suppose it stands at the square grid at the point with coordinates …