题目链接: https://codeforces.com/contest/1159/problem/D 题意: 构造一个长度为$n$的$01$串,最小特殊连续字串的长度为$k$ 也就是,存在最小的$k$,满足,有一个长度为$k$的连续字串没有出现过两次 数据范围: $1 \leq k \leq n \leq 100\,000$$(k \bmod 2) = (n \bmod 2)$ 分析: 典型的构造题,构造了一下午的错误题意,…
首先我们先观察三个串 10,1110,11101110,答案都是红色部分,我们可以下一个结论,形如 1,1101,111101,那么答案为红色部分.我们可以发现,通过我们末尾添加的1,导致之前红色部分的 与我们末尾添加的1与前面一个0构成的 重复,使得之前的红色部分向后挪一位.于是,我们可以用这一规律去构造出我们想要的k,显然答案就是末尾部分的01(蓝色部分111...10111...10111)满足 0 的个数加 1 的个数等于 k-1 1...110111)往后挪一位也就是我们的答案 k ,…
2037. Richness of binary words 题目连接: http://acm.timus.ru/problem.aspx?space=1&num=2037 Description For each integer i from 1 to n, you must print a string si of length n consisting of letters 'a' and 'b' only. The string si must contain exactly i dis…
题目链接: 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点,转移方程肯定是从其他三个点转移. 代码…
Codeforces 题目传送门 & 洛谷题目传送门 蠢蠢的我竟然第一眼想套通项公式?然鹅显然 \(5\) 在 \(\bmod 10^{13}\) 意义下并没有二次剩余--我真是活回去了... 考虑打表找规律(u1s1 这是一个非常有用的技巧,因为这个 \(10^{13}\) 给的就很灵性,用到类似的技巧的题目还有这个,通过对这些模数的循环节打表找出它们的共同性质,所以以后看到什么特殊的数据或者数据范围特别大但读入量 \(\mathcal O(1)\) 的题(比如 CF838D)可以考虑小数据打…
题意:给出一个n,生成n的所有全排列,将他们按顺序前后拼接在一起组成一个新的序列,问有多少个长度为n的连续的子序列和为(n+1)*n/2 题解:由于只有一个输入,第一感觉就是打表找规律,虽然表打出来了,但是依然没有找到规律...最后看了别人的题解才发现 ans [ 3 ] = 1*2*3 + ( ans [ 2 ] - 1 ) * 3 ans[ 4 ] = 1*2*3*4 + ( ans[ 3 ] - 1 ) * 4 感觉每次离成功就差一点点!!! #include<bits/stdc++.h>…
D. Roman Digits time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers…
题目链接: 点击我打开链接 题目大意: 给你 \(n,j\),再给出 \(m[0]\) 的坐标和\(a[0]-a[n-1]\) 的坐标. 让你输出 \(m[j]\) 的坐标,其中 \(m[i]\) 和 \(m[i-1]\) 关于 \(a[(i-1)\%n]\) 对称. 简明题解: \(j\) 最大为\(10^{18}\) ,所以只能打表找规律了. 把两个样例(即\(n==3\)时)的 \(m[1]-m[9]\) 都列出来,结果发现 \(m[0]和m[6],m[1]和m[7]...\)是相等的.…
Nim or not Nim? Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 3032 Description Nim is a two-player mathematic game of strategy in which players take turns removing objects from distinct heaps.…
Permutation Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5753 Description There are two sequences h1∼hn and c1∼cn. h1∼hn is a permutation of 1∼n. particularly, h0=hn+1=0. We define the expression [condition] is 1 when condition is True,is 0 whe…