D. MUH and Cube Walls 说实话,这题看懂题意后秒出思路,和顺波说了一下是KMP,后来过了一会确定了思路他开始写我中途接了个电话,回来kaungbin模板一板子上去直接A了. 题意:有两座城堡,每座城堡有一定的形状分别由高度区分.求第一座城堡中有多少个区间的形状和第二座城堡相似.连续一段区间高度可以任意变,但他们的相对位置是不变的. 思路:基于一段连续区间无论怎么变他们的相对位置不会变,所以分别将两个序列相邻的元素作差,一段区间的相对位置不会变,所以正好可以用差值去匹配.所以K…
D - MUH and Cube Walls Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 471D Description Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo o…
It's time polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got down to business. In total, there are n tasks for the day and each animal should do each of these tasks. For each task, they have e…
先说C 题目链接:http://codeforces.com/problemset/problem/471/C 题目意思:有 n 张卡,问能做成多少种不同楼层(floor)的 house.注意这 n 张卡都要用光.每层 floor 都由一定的 room 构成,每两个相邻 room 规定要有一个公共的ceiling.规定从上到下看,每层 floor 的 room 的数量呈递增的形式排布. 这样的东西一般就是看图,先自己从小数開始推算找规律 能够发现第i层须要(3*i+2)个,那么前i层总的最少须要…
CodeForces - 471A 首先要有四个数相等,然后剩下两个数不同就是Bear,否则就是Elephant. #include <bits/stdc++.h> using namespace std; typedef pair<int,int> PII; int num[10]; int a; int main() { memset(num,0,sizeof(num)); for(int i=1;i<=6;i++) { scanf("%d",&…
A 题意:给出6根木棍,如果有4根相同,2根不同,则构成“bear”,如果剩余两个相同,则构成“elephant” 用一个数组分别储存各个数字出现的次数,再判断即可 注意hash[i]==5的时候,也算作bear,因为它也是满足了4根相同,2根不同 #include<iostream> #include<cstdio> #include<cstring> #include <cmath> #include<stack> #include<v…
Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got hold of lots of wooden cubes somewhere. They started making cube towers by placing the cubes one on top of the other. They defined multiple t…
Codeforces Round #269 (Div. 2) D:http://codeforces.com/problemset/problem/471/D 题意:给定两个序列a ,b, 如果在a中存在一段连续的序列使得a[i]-b[0]==k, a[i+1]-b[1]==k.... a[i+n-1]-b[n-1]==k,就说b串在a串中出现过!最后输出b串在a串中出现几次! 题解:把两个串进行处理,相邻项之间做差,然后就很容易想到用KMP来搞,然后注意几个特判就行. #include<cst…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…