翻转 -- CodeForces - 56B】的更多相关文章

题目链接: https://cn.vjudge.net/problem/25167/origin 思路: 这是一道水题,但是一开始思路有点问题.. 1000的数据大小,直接暴搜左开始第一个与i不等的下标,再从右开始搜第一与i不等的下标 然后用swap,或者reverse翻转一下,再进行对比就行. 有一个小坑就是原本就是顺序的话不行,因为题目明确要求必须翻转一次! 下面是AC代码: #include <iostream> #include <cstdio> using namespa…
A. Flipping Game     time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub got bored, so he invented a game to be played on paper. He writes n integers a1, a2, ..., an. Each of those intege…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a string ss consisting only of lowercase Latin letters. You can rearrange all letters of this string as you wish. Your task is…
http://codeforces.com/gym/100497 codeforces 2014-2015 CT S02E04: Codeforces Trainings Season 2 Episode 4 (US College Rockethon 2014 + COCI 2008-5 + GCJ Finals 2008 C) D题 Board Queries 题意:给出一个n*n方阵,原始全为点,给出m个操作,操作有三种: 1.将x,y为左上角的3*3的格替换为给出的3*3矩阵(元素为点或…
题目链接:http://codeforces.com/contest/98/problem/A 题意大意:给你6种颜色,这6种颜色可能相同也可能不同,把这几种颜色全涂在一个正方体表面,问有多少种涂法(翻转后相同算作一种). 思路:开始枚举全排列枚举所有情况,然后dfs,发现搜出来答案少了,最后发现少考虑了情况,只考虑了固定原始上表面然后顺时针旋转和另外五个面向上翻转,没有考虑另外五个面向上翻转后顺时针转动的情况.. 正解:先固定正方体,全排列枚举所有涂的情况,进行标记,然后再对枚举的每一种情况进…
题目链接:http://codeforces.com/contest/451/problem/B 解题报告:给出一个序列,要你判断这个序列能不能通过将其中某个子序列翻转使其成为升序的序列. 我的做法有点不一样,我是将原来的序列先按照升序排好序,然后分别从头和尾开始扫,找到跟原来的数组不一样的子序列的区间,然后判断这个区间是不是原来的区间翻转而来. #include<cstdio> #include<cstring> #include<iostream> #include…
Hard problem 题目链接: http://codeforces.com/contest/706/problem/C Description Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase Engl…
D. The table 题目连接: http://www.codeforces.com/contest/226/problem/D Description Harry Potter has a difficult homework. Given a rectangular table, consisting of n × m cells. Each cell of the table contains the integer. Harry knows how to use two spells…
C. Alternative Thinking Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/604/problem/C Description Kevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary…
http://codeforces.com/problemset/problem/430/C 题意:在一棵上有n个节点,有n-1条边,在每一个节点上有一个值0或1,然后给你一个目标树,让你选择节点,然后把节点的值翻转,它的孙子节点跟着翻转,依次类推...问经过最少次数可以使这棵树变成目标树. 思路:利用异或的性质,任何数和0异或为它本身,从根节点dfs就行. #include <cstdio> #include <vector> #include <cstring> #…