Codeforces--630E--A rectangle(规律)】的更多相关文章

[题目链接]:http://codeforces.com/problemset/problem/630/E [题意] 给你一个矩形的区域; 然后让你统计这个矩形区域内,有多少个正六边形. [题解] 规律题; x轴的话,每个整数都对应了一个正六边形; 然后y轴的话;大概能看出来,每间隔两个整数对应一个正六边形; 然后如果y的差为偶数的话; 有一半会少一个; 需要减掉; 奇数就不用减; [Number Of WA] 0 [完整代码] #include <bits/stdc++.h> using n…
题目链接: http://codeforces.com/problemset/problem/353/D?mobile=true H. Queue time limit per test 1 secondmemory limit per test 256 megabytes 问题描述 There are n schoolchildren, boys and girls, lined up in the school canteen in front of the bun stall. The b…
B. Cards time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Catherine has a deck of n cards, each of which is either red, green, or blue. As long as there are at least two cards left, she can…
I - Parking Lot Time Limit:500MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Description To quickly hire highly skilled specialists one of the new IT City companies made an unprecedented move. Every employee was granted a…
题目:http://codeforces.com/problemset/problem/135/B 题意:给8个点 判断能否用 4个点构成正方形,另外4个点构成 矩形. 输出 第一行是正方形 ,第二行是矩形. 我的思路:用了4个for循环 枚举四个点, 用向量判断,四个点构成 六条边,如果这六条边里, 有四条边 与他们垂直的边有两个,就说明是矩形,在这个基础上,有 2条边 与他们垂直的边有一个. 说明是正方形. #include<iostream> #include<cstdio>…
Description You are given an integer N. Consider all possible segments (线段,划分)on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be  of them. You want to draw these segments in several laye…
C. Really Big Numbers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks…
题目链接:点击打开链接 3个数为一组,找最大的一个数让它降低,则显然是有解的,分类讨论一下就可以 #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<vector> using namespace std; int n, k; int a[4]; vector<pair<int,int> >ans; int m…
You are given three integers aa, bb and xx. Your task is to construct a binary string ssof length n=a+bn=a+b such that there are exactly aa zeroes, exactly bb ones and exactly xx indices ii (where 1≤i<n1≤i<n) such that si≠si+1si≠si+1. It is guarante…
题目链接:点击打开链接 题意: 输出n l x y 有一根直尺长度为l 上面有n个刻度. 以下n个数字是距离开头的长度(保证第一个数字是0,最后一个数字是l) 要使得 直尺中存在某2个刻度的距离为x . 某2个刻度的距离为y 要加入最少几个刻度. 问: 最少的刻度个数 输出标记的位置. 思路: 分类讨论一下.. 若本身尺子里就有x.y就输出0 若仅仅有x 或仅仅有y就输出一个刻度. 若2个都没有就: 1.加1个刻度ans.这个ans是距离某个刻度距离为x的,然后看一下是否有距离ans为y的刻度,…
Time limit 1000 ms Memory limit 262144 kB 解题思路 一堆循环嵌套的那种dp,不好想.但是可以搜啊,很暴力的.记忆化一下就好. 我们定义搜索函数\(\text{search}(x1,y1,x2,y2)\),代表将矩形区域\([x1,x2]\).\([y1,y2]\)内部全部染白的最小代价. 我们可以知道,如果这个区域内全白,那么代价显然就是0. 如果全黑,那么不妨一次性全部染白,拆开成几个小的矩形并分别染色不会使结果更优.证明(其他大小的矩形可以类比):\…
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…
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…
题目链接: http://codeforces.com/contest/664/problem/C 题解: 这题最关键的规律在于一位的有1989-1998(9-8),两位的有1999-2098(99-98),三位的有2099-3098(099-098),四位的有3099-13098(3099-3098) 所以关键字长度一样的会连续出现,1989+0代表一位的开始,1989+10代表两位的开始,1989+10+100代表三位的开始, 现在给你一个长度为len的标志,就可以找出该数位的起始位置198…
C. Rectangle Puzzle Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/281/problem/C Description You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the cen…
C. Median Smoothing Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/problem/C Description A schoolboy named Vasya loves reading books on programming and mathematics. He has recently read an encyclopedia article that des…
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…
C. Plus and Square Root time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, ' + ' (plus) an…
题目链接: http://codeforces.com/problemset/problem/696/B 题目大意: 给一棵树,从根节点开始递归,time=1,每次递归等概率随机访问这个节点的子节点,走过不会再走,每访问到一个新节点time+1,求访问每个节点的时间的期望. 题目思路: [数学规律] 这题其实是一道概率DP的题目,但是找规律后发现答案和当前结点的子树大小有关. ans[v]=ans[u]+1+0.5*(child[u]-child[v]-1),child为当前节点的子树大小. /…
Codeforces 1091D New Year and the Permutation Concatenation https://codeforces.com/contest/1091/problem/D 题目: Let n be an integer. Consider all permutations on integers 1 to n in lexicographic order, and concatenate them into one big sequence p. For…
题目链接: https://codeforces.com/contest/166/problem/E 题目: 题意: 给你一个三菱锥,初始时你在D点,然后你每次可以往相邻的顶点移动,问你第n步回到D点的方案数. 思路: 打表找规律得到的序列是0,3,6,21,60,183,546,1641,4920,14763,通过肉眼看或者oeis可以得到规律为. dp计数:dp[i][j]表示在第i步时站在位置j的方案数,j的取值为[0,3],分别表示D,A,B,C点,转移方程肯定是从其他三个点转移. 代码…
B. Rectangle and Square 题目连接: http://codeforces.com/contest/135/problem/B Description Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise di…
发现自己容易被卡水题,需要强行苟一下规律题 CF上并没有对应的tag,所以本题集大部分对应百毒搜索按顺序刷 本题集侧重于找规律的过程(不然做这些垃圾题有什么用) Codeforces - 1008C 给定一个\(n\)的可重复排列,要求你更换排列的顺序,使尽量多的数占领到比自己数值小的数的所在位置 (暂时没有tutorial,有空我会加上正解做法) 其实按题目硬上应该是尽量的排序后1位错排,可是对于复杂情况无法保证 那不如按照一定顺序观察规律,只关注答案 由于值是离散的而且无顺序相关,那就很好找…
题目传送门 /* 找规律/贪心:ans = n - 01匹配的总数,水 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <cmath> using namespace std; ; const int INF = 0x3f3f3f3f; char s[MAXN]; int main(void) //Codeforce…
题目传送门 /* 找规律,水 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <cmath> using namespace std; ; const int INF = 0x3f3f3f3f; ]; int main(void) //Codeforces Round #309 (Div. 2) A. Kyoya a…
题目链接:http://codeforces.com/contest/820/problem/C 题解:显然a<=b的规律很好找只要 例如a=2,b=5,只要这样排列就行abbbbbbabbbbbbabbbbbb.... 然后a>b的规律是 例如a=5,b=2,只要这样的排列就行abcdeeeabfghhhabcdeeeanfghhh..... 当然满足这些条件的话就可以求出大于r-l>T的结果(T=2*(a+b)) 显然if(a <= b) ans = a + 1; else a…
Educational Codeforces Round 78 (Rated for Div. 2) 1278B - 6 B. A and B  time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given two integers aa and bb. You can perform a sequence of…
题目描述: Little Elephant and Interval time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The Little Elephant very much loves sums on intervals. This time he has a pair of integers l and r (l ≤ r…
题目链接:http://codeforces.com/contest/1206/problem/C 题解 : 观察可以发现当n为偶数时,1 - 2n是不满足题意的,可以举例n = 2,n = 4试一试.那么当n为奇数时,则满足题意,通过n = 3和n = 5的情况可以发现一个规律,当a[ 1 ] = 1时候,a[ n + 1] = 2 ,a[ 2 ] =  4,此时 a[ n + 1]  = 3,a[ 3 ] = 5,则a[ n+ 3] = 6,发现a[ i ] 和a[ i + n] 是连续的两…
Codeforces 题目传送门 & 洛谷题目传送门 蠢蠢的我竟然第一眼想套通项公式?然鹅显然 \(5\) 在 \(\bmod 10^{13}\) 意义下并没有二次剩余--我真是活回去了... 考虑打表找规律(u1s1 这是一个非常有用的技巧,因为这个 \(10^{13}\) 给的就很灵性,用到类似的技巧的题目还有这个,通过对这些模数的循环节打表找出它们的共同性质,所以以后看到什么特殊的数据或者数据范围特别大但读入量 \(\mathcal O(1)\) 的题(比如 CF838D)可以考虑小数据打…