Codeforces 474 C. Captain Marmot】的更多相关文章

4*4*4*4暴力+点的旋转+推断正方型 C. Captain Marmot time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Captain Marmot wants to prepare a huge and important battle against his enemy, Captain Snake. For this…
C. Captain Marmot time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Captain Marmot wants to prepare a huge and important battle against his enemy, Captain Snake. For this battle he has n regi…
C. Captain Marmot time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Captain Marmot wants to prepare a huge and important battle against his enemy, Captain Snake. For this battle he has n regi…
题目链接:http://codeforces.com/contest/474/problem/C 解题报告:给一个n,然后输入4*n个平面坐标系上的点,每四个点是一组,每个点有一个中心,这四个点可以分别围绕这个中心旋转,每次只能逆时针转90度,现在问你要使这四个点形成一个正方形最少要转的次数是多少. 枚举这四个点转的次数分别为0,1,2,3,只要这四种,因为再转的话就回到原来的状态循环了.然后对于每种情况分别判断是不是组成正方形就可以了,关键是求旋转后的坐标,和判断是不是正方形的问题. 假设这个…
题目链接:点击打开链接 题意: 给定T表示case数 以下4行是一个case 每行2个点,u v 每次u能够绕着v逆时针转90° 问最少操作多少次使得4个u构成一个正方形. 思路: 枚举判可行 #include <iostream> #include <cmath> #include <algorithm> #include <cstdio> using namespace std; int hah,ijj; int haifei; template <…
题意:给定 4n * 2 个坐标,分成 n组,让你判断,点绕点的最少次数使得四个点是一个正方形的顶点. 析:那么就一个一个的判断,n 很小,不会超时,四个点分别从不转然后转一次,转两次...转四次,就这样算下去,那么如何判断是不是正方形呢?这样判定就行,把每个边都求出来,然后判定, 这里肯定有四个边是一样,另外两个是一样的,而且还不是0,因为可能重合,关键是旋转后怎么算呢?有两个公式,假设点(x, y)绕点(a, b)转 x 角度,那么旋转后的坐标为 (xx, yy),应该是, xx = (x…
水太...... E. Pillars time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Marmot found a row with n pillars. The i-th pillar has the height of hi meters. Starting from one pillar i1, Marmot wants…
题意: 有n朵花排成一排,小明要么吃掉连续的k朵白花,或者可以吃单个的红花. 给出一个n的区间[a, b],输出总吃花的方法数模 109+7 的值. 分析: 设d(i)表示吃i朵花的方案数. 则有如下递推关系: d[i] = d[i-1] + d[i-k], (i ≥ k, d[0] = 1) 我们在计数i+1的情况时,可以分为如下两种情况: 最后一朵是红花,方案数为d[i] 最后k朵是白花,方案数为d[i-k] 然后预处理一下前缀和. 代码中注意取模. #include <cstdio> +…
线段树求某一段的GCD..... F. Ant colony time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mole is hungry again. He found one ant colony, consisting of n ants, ordered in a row. Each ant i (1 ≤ i ≤ n)…
题目地址:http://codeforces.com/contest/474 A题:Keyboard 模拟水题. 代码例如以下: #include <iostream> #include <cstdio> #include <string> #include <cstring> #include <stdlib.h> #include <math.h> #include <ctype.h> #include <que…