
CF
毕竟技能会躲人
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
F. Spy-string(模拟)
题目大意:给定n个长度相同的字符串,如果能构造出一个字符串,使得其于每个字符串不同的字母个数小于等于1的话,输出这个字符串,否则输出-1.如果我们直接暴力每个位置选择的字母的话,复杂度是26^m,尽管n和m只有10的范围,但还是直接爆炸。优化:我们可以一开始让ans等于输入字符串的其中一个,方便起见让它等于第一个字符串。然后我们可以枚举m个位置的字母,每个位置都枚举一下26个字母。这样复杂度就是26*m,然后我们把这个改变的字符串check一下,看看与n个字符串是否相差1个字母。代码:#inclu.原创 2020-05-28 16:35:21 · 678 阅读 · 0 评论 -
D. Buying Shovels(根号n枚举因子+二分)
题目大意:求在1到k范围内n的最大公因子是什么,输出n/n的最大公因子。首先当k>=n的时候直接输出1就行。然后我们可以用根号n的算法,枚举出n的所有因子,把这些因子装进数组里,将这个数组排序,这样就变成了升序的因子。然后我们用二分,找到第一个大于k的下标,这样答案就是n/ans[下标-1]了;代码:#include <cstdio>#include <iostream>#include <algorithm>#include <cstrin.原创 2020-05-28 13:26:52 · 537 阅读 · 0 评论 -
Codeforces Round #636 (Div. 3)
A:题意:求最小的x使得上图公式成立,且k是大于1的正整数,x是正整数。思路:有题意知x和n均为正整数,根据上面,我们可以从小到大枚举K,使得n%(1+2+。。。+2^(K-1))==0即可#include <cstdio>#include <iostream>#include <cmath>using namespace std;int ma...原创 2020-04-27 14:32:48 · 178 阅读 · 0 评论 -
E1. Three Blocks Palindrome (easy version)
The only difference between easy and hard versions is constraints.You are given a sequence aa consisting of nn positive integers.Let’s define a three blocks palindrome as the sequence, consisting of...原创 2020-04-15 20:59:02 · 513 阅读 · 0 评论 -
Codeforces Round #634 (Div. 3)
太菜了只会前四道水题菜鸡也想发一下自己的代码,明天把E1补上:A:Candies and Two Sisters#include <cstdio>#include <iostream>using namespace std;typedef long long ll;int main(){ int a; cin>>a; while(a--)...原创 2020-04-14 21:16:02 · 153 阅读 · 1 评论