链接: https://codeforces.com/contest/1182/problem/A 题意: You have a given integer n. Find the number of ways to fill all 3×n tiles with the shape described in the picture below. Upon filling, no empty spaces are allowed. Shapes cannot overlap. This pict…
Codeforces Round #566 (Div. 2) A Filling Shapes 给定一个 \(3\times n\) 的网格,问使用 这样的占三个格子图形填充满整个网格的方案数 如果 \(n\) 是奇数,那么显然无解,否则考虑每个 \(3\times2\) 的方格正好能塞下两个这玩意而且必须这样塞进去,方案数为 \(2\),因此答案为 \(2^{n/2}\) B Plus from Picture 给定一个 \(h\times w\) 的矩阵,每个元素为 "." 或者…
时间\(9.05\)好评 A Filling Shapes 宽度为\(3\),不能横向填 考虑纵向填,长度为\(2\)为一块,填法有两种 如果长度为奇数则显然无解,否则\(2^{n/2}\) B Plus from Picture 找到最靠上的十字轮廓(没有则直接无解),删掉后判断有无多余 C Beautiful Lyrics 以元音数量及最后的元音(如果没有元音的那些分别赋不同的负数)为一二关键词 开两个栈,代表诗头和诗尾 排序后,得到的以第一关键字的块,尽量把每一对放到诗尾,因为诗尾的也可以…
链接: https://codeforces.com/contest/1182/problem/C 题意: You are given n words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyric…
链接: https://codeforces.com/contest/1182/problem/B 题意: You have a given picture with size w×h. Determine if the given picture has a single "+" shape or not. A "+" shape is described below: A "+" shape has one center nonempty c…
链接: https://codeforces.com/contest/1228/problem/B 题意: Suppose there is a h×w grid consisting of empty or full cells. Let's make some definitions: ri is the number of consecutive full cells connected to the left side in the i-th row (1≤i≤h). In partic…
传送门 题目 \[ \begin{aligned} &f_n=c^{2*n-6}f_{n-1}f_{n-2}f_{n-3}&\\ \end{aligned} \] 思路 我们通过迭代发现\(f_n\)其实就是由\(c^{t_1},f_1^{t_2},f_2^{t_3},f_3^{t_4}\)相乘得到,因此我们可以分别用矩阵快速幂求出\(t_1,t_2,t_3,t_4\),最后用快速幂求得答案. 对于\(n<=3\)的我们直接输出即可,\(n>3\)的我们先将\(n\)减去\(3…
#include<bits/stdc++.h>using namespace std;string s[100007];set<int>st[100007][7];int t[207];int a[100007],b[100007][2],c[100007],d[100007][2];int main(){ t['a']=1; t['e']=2; t['i']=3; t['o']=4; t['u']=5; int n; cin>>n; for(int i=1;i<…
题意:问有多少种组合方法让每一行每一列最小值都是1 思路:我们可以以行为转移的状态 附加一维限制还有多少列最小值大于1 这样我们就可以不重不漏的按照状态转移 但是复杂度确实不大行(减了两个常数卡过去的...) #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const double eps = 1e-6; const int N = 3e5+7; typedef long long ll; co…
Codeforces Round #633(Div.2) \(A.Filling\ Diamonds\) 答案就是构成的六边形数量+1 //#pragma GCC optimize("O3") //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<bits/stdc++.h> using namespace std; function<void(void)> __…