题目链接:http://codeforces.com/contest/451/problem/B ---------------------------------------------------------------------------------------------------------------------------------------------------------- 欢迎光临天资小屋:http://user.qzone.qq.com/593830943/ma…
B. Sort the Array time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distin…
题目链接:http://codeforces.com/contest/451/problem/B 思路:首先找下降段的个数,假设下降段是大于等于2的,那么就直接输出no,假设下降段的个数为1,那么就把下降段的起始位置和结束位置记录下来然后进行推断,在进行推断时,有几种特殊情况:(s表示起始位置,e表示结束位置) 1.当e==n&&s!=1时,满足a[n]>a[s-1]输出yes: 2当s==1&&==n时,满足a[1]<a[e+1] 输出yes: 3当s==1&…
解题报告 http://blog.csdn.net/juncoder/article/details/38102391 对于给定的数组,取对数组中的一段进行翻转,问翻转后是否是递增有序的. 思路: 仅仅要找到最初递减的区域,记录区域内最大和最小的值,和区间位置. 然后把最大值与区间的下一个元素对照,最小值与区间上一个元素对照. 这样还不够,可能会出现两个或两个以上的递减区间,这样的情况直接pass,由于仅仅能翻转一次. #include <iostream> #include <cstd…
D. Count Good Substrings 题目连接: http://codeforces.com/contest/451/problem/D Description We call a string good, if after merging all the consecutive equal characters, the resulting string is palindrome. For example, "aabba" is good, because after…
A. Game With Sticks 题目连接: http://codeforces.com/contest/451/problem/A Description After winning gold and silver in IOI 2014, Akshat and Malvika want to have some fun. Now they are playing a game on a grid made of n horizontal and m vertical sticks. A…
B. Wilbur and Array Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/596/problem/B Description Wilbur the pig is tinkering with arrays again. He has the array a1, a2, ..., an initially consisting of n zeros. At one step, he…
转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud 本场题目都比较简单,故只写了E题. E. Vanya and Field Vanya decided to walk in the field of size n × n cells. The field contains m apple trees, the i-th apple tree is at the cell with coordinates(xi, yi). Van…
Codeforces Round #258 (Div. 2)[ABCD] ACM 题目地址:Codeforces Round #258 (Div. 2) A - Game With Sticks 题意:  Akshat and Malvika两人玩一个游戏,横竖n,m根木棒排成#型,每次取走一个交点,交点相关的横竖两条木棒要去掉,Akshat先手,给出n,m问谁赢. 分析:  水题,非常明显无论拿掉哪个点剩下的都是(n-1,m-1),最后状态是(0,x)或(x,0),也就是拿了min(n,m)-…
A. Game With Sticks (451A) 水题一道,事实上无论你选取哪一个交叉点,结果都是行数列数都减一,那如今就是谁先减到行.列有一个为0,那么谁就赢了.因为Akshat先选,因此假设行列中最小的一个为奇数,那么Akshat赢,否则Malvika赢. 代码: #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace…