CodeForces
布呗之路
每个人都有不同的路,所以每个人都会孤独。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Codeforces Global Round 7 D2. Prefix-Suffix Palindrome
D2. Prefix-Suffix Palindrome (Hard version) 题意 给定一个字符串SSS,找出最长的符合下列条件的字符串TTT TTT的长度不超过SSS TTT是一个回文串 存在字符串aaa和bbb,使得T=a+bT=a+bT=a+b,其中aaa,bbb分别为TTT的前缀和后缀。 输入描述 多组测试数据,第一行一个ttt,表示测试样例的组数。 接下来ttt行,...原创 2020-03-21 16:18:56 · 386 阅读 · 0 评论 -
Codeforces Round #628 (Div. 2) C,D
C. Ehab and Path-etic MEXs 题意 给定一颗包含nnn个节点的树,现在需要对树的边进行添加权值,所填权值的范围为[0,n−2][0,n-2][0,n−2],问怎么添加权值,使得任意两点的简单路径的长度最大值最小。 输入描述 第一行一个nnn表示树节点的个数 接下来n−1n-1n−1行,每行两个数u,vu,vu,v,表示u和v存在一条边. 输入保证是一颗树,2≤n≤1...原创 2020-03-15 12:35:45 · 359 阅读 · 0 评论 -
Codeforces Round #533 (Div. 2) C. Ayoub and Lost Array 区间满足被3整除的数组的个数
C. Ayoub and Lost Array /** 题意:将[l,r]的数字填进长度为n的数组,问:满足数组的和为3的倍数的数组的个数; 经典数位dp:由于%3,因此考虑三位0 1 2,分别记录对应区间取余之后0,1,2的个数,最后进行数位dp即可 */ #include <iostream> #include <algorithm> #include &l...原创 2019-02-12 15:33:05 · 765 阅读 · 0 评论 -
Codeforces Global Round 1 A--E
A. Parity /** 题意:进制转换,判结果奇偶 */ #include<bits/stdc++.h> #define ll long long using namespace std; int main (){ int b,k,ans=0;cin>>b>>k; for(int i=0;i<k;i++){ int...原创 2019-02-10 16:53:44 · 368 阅读 · 0 评论 -
Good Bye 2018 D 全排列的排列数目
D. New Year and the Permutation Concatenation /** 题意:把 n 的所有排列按照字典序写在一起,问存在多少条长度为n的区间为n的一个全排列; 强行oeis打表 公式过程化简 */ #include<bits/stdc++.h> #define ll long long using namespace std; const...原创 2019-01-23 15:35:36 · 341 阅读 · 0 评论 -
Good Bye 2018 C 步长任意返回1的不同路径和
C. New Year and the Sphere Transmission /** 题意:给你一个环,现在以步长 k 在环上跳跃,得到 1->1+k-->1+2*k.....->1 ; 将经过的所有的数加起来,得到一个和,输出所有不同的和 分析: 可证:能跳回1的不同的步长肯定是n的约数; 最后直接等差数列求和即可 */ #include<bits...原创 2019-01-23 14:30:38 · 312 阅读 · 0 评论 -
Codeforces Round #200 (Div. 1) C. Read Time 二分
/** Codeforces Round #200 (Div. 1) C. Read Time 二分 链接:https://codeforces.com/contest/343/problem/C 题意:n个刷子 m个原点 n个刷子同时左右进行刷 问最少的时间使得m个点都能够被刷到; 分析 : 直接二分暴力查找答案 由于刷子存在的点和原点都是递增的 因此每次看枚举的次数看是否能够遍历所有的点...原创 2018-09-10 17:54:53 · 288 阅读 · 0 评论 -
CodeForces 371C Hamburgers 二分
/** CodeForces 371C Hamburgers 二分 链接:https://codeforces.com/problemset/problem/371/C 题意:给定一个只含'B' 'S' 'C' 字符的字符串; 现在给出部分'B' 'S' 'C' 的数量 及 分别对应字符的价格; 现在拥有sum的钱 这些能够买到相应的字符 问 买入部分字符后 最多能够得到多少个原始的字符串 ...原创 2018-09-10 17:53:52 · 391 阅读 · 0 评论 -
Codeforces Round #136 (Div. 1) B. Little Elephant and Array 莫队裸题
#include<bits/stdc++.h> #define ll unsigned long long using namespace std; /**********************************************Head-----Template****************************************/ bool Finis...原创 2018-08-17 18:34:36 · 230 阅读 · 0 评论 -
Codeforces Round #502 (in memory of Leopoldo Taravilse, Div. 1 + Div. 2) A~~D
/** A. The Rank 链接:https://codeforces.com/contest/1017/problem/A 题意:Thomas's rank 暴力 排序均可 */ // eg:test 1 #include<bits/stdc++.h> using namespace std; struct node{ int sum,id; bool o...原创 2018-08-09 14:26:37 · 225 阅读 · 0 评论 -
Codeforces Round #340 (Div. 2) E. XOR and Favorite Number (莫队裸题)
/** 链接:https://codeforces.com/contest/617/problem/E 题意:区间异或值为k的不同的区间的个数 sum[i]:a[1]^a[2]^a[3]^....^a[i] 表示 前缀异或和 存在a[l]^a[l+1]^a[l+2]^.....a[r]=sum[l-1]^sum[r]; 因此找这样的一个区间的话 由于区间是连续的(废话) 如果sum[l-...原创 2018-07-29 23:25:55 · 479 阅读 · 0 评论 -
Codeforces Round #496 (Div. 3) E2. Median on Segments (General Case Edition) 中位数为m的区间的个数
E2. Median on Segments (General Case Edition)time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an integer sequence a1,a2,…,an.Find the...原创 2018-07-11 19:00:56 · 494 阅读 · 0 评论 -
Codeforces Round #481 (Div. 3) F. Mentors 思维
BUG反馈门F. Mentorstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn BerSoft nn programmers work, the programmer ii is characterized by a skill riri...原创 2018-05-16 21:26:04 · 432 阅读 · 2 评论 -
Codeforces Round #483 (Div. 2) D. XOR-pyramid 连续子区间异或最大和
D. XOR-pyramidtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputFor an array bb of length mm we define the function ff asf(b)={b[1]if m=1f(b[1]⊕b[2]...原创 2018-05-16 20:35:04 · 988 阅读 · 0 评论
分享