Codeforces 650B Image Preview】的更多相关文章

题目链接 B. Image Preview time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and ri…
题目大概说手机有n张照片.通过左滑或者右滑循环切换照片,滑动需要花费a时间:看一张照片要1时间,而看过的可以马上跳过不用花时间,没看过的不能跳过:有些照片要横着看,要花b时间旋转方向.那么问T时间下最多可以看多少张相片. 先确定左滑最多能看到哪张,然后用另一个指针从第一张照片往右移动,这代表先右滑然后左滑的方式看照片,而每次向右的指针移动计算其时间,不合法的话就通过向左的指针向右移修正时间: 而先左滑然后右滑的方式同理. 模拟题,好难写..不过写好后提交居然就1A了.. #include<cst…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent ph…
汕头市队赛题目传送门 codeforces题目传送门 这道题我的做法是 尝试先往左走然后往右走 或者先往右走然后往左走 然后注意一下枚举顺序就okay啦 #include<cstdio> #include<cstring> #include<algorithm> #define LL long long using namespace std; ; LL read(){ LL ans=,f=,c=getchar(); ; c=getchar();} +(c-'); c=…
题意: 若干张照片,从头开始可以向左右两边读,已经读过的不需要再读,有的照片需要翻转,给定读.滑动和翻转消耗的时间,求在给定时间内最多能读多少页? 分析: 首先明确,只横跨一次,即先一直读一边然后再一直读另一边,这样消耗的滑动时间最少.是否能在给定时间内读完页数很好判断,所以用二分+枚举,先枚举左边的所有可能情况,再二分右边求出最大页数, 再枚举右边,求出左边.取两边的最大值即可. 代码: #include<iostream> #include<cstdio> #include&l…
D. Image Preview 题目连接: http://www.codeforces.com/contest/651/problem/D Description Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over…
题目链接: http://codeforces.com/contest/651/problem/D D. Image Preview time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya's telephone contains n photos. Photo number 1 is currently opened on…
题目链接 题意:看一个图片需要1单位时间,如果是 w 需要翻转 b 时间,切换到相邻位置(往左或者往右)需要 a 时间,求T时间最多能看几张图片 从第一个开始向右走看若干个图片然后往如果往左走就不会再往右走了,也就是只能一次改变方向,多次改变方向就得不偿失了,浪费时间.所以一次枚举能看图片的数量n,往右能看1到n个,那么往左就有 (n - 往右的)个,然后算出时间跟T相比 #include <iostream> #include <cstdio> #include <cstr…
Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over the screen. If you swipe left from the first photo, you reach photo n. Similarly,…
Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed to move left and right to the adjacent photo by swiping finger over the screen. If you swipe left from the first photo, you reach photo n. Similarly,…