![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Codeforce
Lngxling
这个作者很懒,什么都没留下…
展开
-
CodeForces - 768C Jon Snow and his Favourite Number —— 规律题
题意:进行操作,将数列排序,奇数位上的数与x异或,问重复进行k次操作,得到的数列中最小和最大值是多少思路:多找几个数模拟一下可以看出是有循环节存在的,就直接暴力找循环节,然后取一下模#include <iostream>#include <cstdio>#include <cmath>#include <vector>#in...原创 2018-10-10 10:13:22 · 371 阅读 · 0 评论 -
CodeForces - 598D Igor In the Museum
D. Igor In the Museumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIgor is in the museum and he wants to see as many pictures as possible.Museum ...原创 2018-03-19 22:58:34 · 165 阅读 · 0 评论 -
CodeForces - 598C Nearest vectors
C. Nearest vectorstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given the set of vectors on the plane, each of them starting at the orig...原创 2018-03-19 22:54:29 · 225 阅读 · 0 评论 -
CodeForces 620C Pearls in a Row
C. Pearls in a Rowtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n pearls in a row. Let's enumerate them with integers from 1 to n from...原创 2018-03-19 22:48:59 · 206 阅读 · 0 评论 -
CodeForces - 620D Professor GukiZ and Two Arrays —— 二分
D. Professor GukiZ and Two Arraystime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputProfessor GukiZ has two arrays of integers, a and b. Professor wa...原创 2018-03-19 22:43:44 · 223 阅读 · 0 评论 -
CodeForces - 620E —— 线段树 dfs序
E. New Year Treetime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe New Year holidays are over, but Resha doesn't want to throw away the New Year ...原创 2018-03-19 22:38:35 · 256 阅读 · 0 评论 -
CodeForces - 908A New Year and Counting Cards
A. New Year and Counting Cardstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYour friend has n cards.Y原创 2018-02-05 20:54:02 · 147 阅读 · 0 评论 -
CodeForces - 908B New Year and Buggy Bot
B. New Year and Buggy Bottime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputBob programmed a robot to navigate原创 2018-02-05 20:52:01 · 397 阅读 · 0 评论 -
CodeForces - 567D One-Dimensional Battle Ships —— 二分思维
D. One-Dimensional Battle Shipstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice and Bob love playing o原创 2018-02-05 20:42:07 · 260 阅读 · 0 评论 -
CodeForces - 462B Appleman and Card Game
B. Appleman and Card Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAppleman has n cards. Each card ha原创 2018-02-05 20:30:05 · 196 阅读 · 0 评论 -
CodeForces - 214A System of Equations
A. System of Equationstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFurik loves math lessons very much,原创 2018-02-05 20:14:49 · 338 阅读 · 0 评论 -
CodeForces - 192A Funky Numbers ——二分
A. Funky Numberstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs you very well know, this year's funkies原创 2018-02-05 20:08:35 · 289 阅读 · 0 评论 -
CodeForces - 915B Browser
B. Browsertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLuba is surfing the Internet. She currently has n原创 2018-01-23 21:12:51 · 288 阅读 · 0 评论 -
CodeForces - 165C Another Problem on Strings —— 前缀和字串
C. Another Problem on Stringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA string is binary, if it con原创 2018-01-23 19:58:09 · 293 阅读 · 0 评论 -
CodeForces - 165B Burning Midnight Oil ——二分
B. Burning Midnight Oiltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day a highly important task was原创 2018-01-23 19:13:03 · 208 阅读 · 0 评论 -
CodeForces - 609D Gadgets for dollars and pounds —— 二分 预处理
D. Gadgets for dollars and poundstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNura wants to buy k gadgets. She has only s bu...原创 2018-08-28 11:58:00 · 247 阅读 · 0 评论 -
CodeForces - 742C Arpa's loud Owf and Mehrdad's evil plan
C. Arpa's loud Owf and Mehrdad's evil plantime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs you have noticed, there are lovely ...原创 2018-08-28 13:12:28 · 193 阅读 · 0 评论 -
CodeForces - 633C Spy Syndrome 2 —— 字典树+dfs
题意:问一个字符串能否由一些单词反转,再转为小写后构成思路:用字典树记录每个字符串,然后dfs进行搜索字典树要先向后取值再判断能否形成单词..好久不写手都生了#include <iostream>#include <cstdio>#include <cmath>#include <vector>#include <...原创 2018-09-30 16:47:39 · 334 阅读 · 0 评论 -
Gym - 101775L SOS —— 规律
题意:长度n的棋盘,依次向里面放S或者O,谁下的时候形成了SOS谁就赢Panda先手Sheep后手思路:这题真的蛮有趣所有情况中,只有形成了S - - S这种情况时,不管再向里面填了什么,另一个人都会赢,这是这题的突破口(1)当n小于7的时候,随便模拟一下知道最优情况下都是平局,不会有一个人会让另一个人赢(2)当n为大于7的奇数时,先手必胜以7为例:先手 ...原创 2018-09-30 10:07:08 · 673 阅读 · 0 评论 -
CodeForces - 632C The Smallest String Concatenation
题意:将所有的字符串连接使得字典序最小思路:精妙!#include <iostream>#include <cstdio>#include <cmath>#include <vector>#include <map>#include <set>#include <stack>#inc原创 2018-09-30 08:47:23 · 205 阅读 · 0 评论 -
CodeForces - 632B Alice, Bob, Two Teams ——思维
题意:选定字符串的一个前缀或者后缀,将里面的A变为B,B变为A,问所有B下标对应值的和的最大值思路:将区间反转也就是在原本的基础上加A的值,减B的值,从前到后或者从后到前遍历,记录当前这些值和的最大值如果不是选定前缀后缀,而是任意选定一段区间,可以用尺取法选一段区间和的最大值#include <iostream>#include <cstdio>#...原创 2018-09-30 08:45:17 · 321 阅读 · 0 评论 -
CodeForces - 618A Slime Combining
题意:不断地向当前数列的最右侧放1,一旦出现连续的两个数x相等,就合并为x+1,问放n次1最后数列的值思路:因为是两个1合并形成2,所以可以看作二进制的加减,模拟一下就会发现答案就是n的二进制的每个1所在的位置#include <iostream>#include <cstdio>#include <cmath>#include <...原创 2018-10-02 09:46:27 · 283 阅读 · 0 评论 -
CodeForces - 618B Guess the Permutation
题意:矩阵里bij=min(ai,aj)求满足条件的a数组思路:胡乱搞一下,每行出现次数最多的数就是数组这个这个位置的数,最后剩两个出现都出现一次的,一个放n一个放n-1#include <iostream>#include <cstdio>#include <cmath>#include <vector>#includ...原创 2018-10-02 09:40:39 · 240 阅读 · 0 评论 -
CodeForces - 633D Fibonacci-ish —— 斐波那契数列
题意:有1000个数,问能形成的最长斐波那契数列的长度思路:只要确定了数列的前两项,数列就已经确定了,所以可以枚举前两项,来找剩下的最长因为数的绝对值小于1e9,斐波那契数列的增长速度很快,项数很少用map记录了一下每个数出现的个数,方便搜索要特判0的情况,因为0很多,就退化为n^3的复杂度了#include <iostream>#include <...原创 2018-10-02 09:33:15 · 289 阅读 · 0 评论 -
CodeForces - 635D Factory Repairs —— 点更新 区间查询
题意:工厂生产产品,开始时每天生产b个,维修连续的k天后变成每天生产a个第di天有需求量为ai的订单,每个订单只能当天生产,不能今天生产的明天卖问若从某天开始维修,能完成的订单里的产品总数思路:用线段树维护,每个节点里分别记录这个区间内修理之前和修理之后能完成的产品总数,询问时分别查询修理前和修理后要注意订单是可以叠加的,点更新时不是赋值是累加#include <...原创 2018-10-02 09:23:39 · 203 阅读 · 0 评论 -
CodeForces - 450B Jzzhu and Sequences
思路:移项得到Fn=Fn-1-Fn-2构造矩阵1 -11 0注意long long 取模 和n=1和2的情况#include <iostream>#include <cstdio>#include <cmath>#include <vector>#include <map>#include <s...原创 2018-09-07 10:45:51 · 189 阅读 · 0 评论 -
CodeForces - 965C Greedy Arkady
题意:k个人分n个糖果,糖果会按轮发放,每一轮里每个人都会得到x个,再进行下一轮,发完即止,发糖的人每次发的糖果数不能大于m个,并且每个人都至多收到d次,问发糖的人最多收到多少个糖。发糖的人永远是每一轮第一个收到糖果的。思路:最优的情况一定是发糖的人正好收到最后的x个,剩下的人就都比他少一轮枚举一下发糖的轮数,直接按最优情况计算一下能收到的糖的个数,取最大值#include ...原创 2018-08-29 13:36:27 · 174 阅读 · 0 评论 -
CodeForces - 616C The Labyrinth
题意:把图中某个 * 变成 . 之后,这个位置所在的 . 块中 . 的个数%10思路:把*变成 . 之后,这个块的个数就是它上下左右四个 . 块的个数和,如果有处于同一个块的只要加一次预处理出来所有 . 块的个数和块号,每个 * 的位置直接计算#include <bits/stdc++.h>using namespace std;int n,m;char m...原创 2018-08-29 11:05:52 · 171 阅读 · 0 评论 -
CodeForces - 711B Chris and Magic Square 水题
题意:给矩阵中0位置填数,问能不能使得矩阵的每一行的和、每一列的和、两个对角线的和都相等。保证矩阵中只有一个0.思路:从行和和列和计算出0位置要填的数,再判断对角线开始读错了题意WA了好几发...#include <bits/stdc++.h>#define ll long longusing namespace std;int n;ll row[60...原创 2018-08-29 10:54:32 · 184 阅读 · 0 评论 -
CodeForces - 750C New Year and Rating —— 思维
题意:大于等于1900分的是第一梯队,小于等于1899的是第二梯队,给出n次分数的变化和变化前所处的梯队,问是不是合理的,如果是合理的,输出最后最高的可能分数,无限大输出 Infinity思路:分数的变化相当于一个折线图,如果我们把开始点看做0的话,要想让最终结果最大,就需要把折线图上移,最多上移到二梯队的最高点在1899处。如果所有的分数都在一梯队,最高就是无限,如果一梯队的最...原创 2018-08-29 10:49:48 · 188 阅读 · 0 评论 -
CodeForces - 631D Messenger —— kmp思维
D. Messengertime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputEach employee of the "Blake Techologies" company uses a special mes...原创 2018-08-29 10:21:02 · 329 阅读 · 0 评论 -
CodeForces - 732D Exams —— 二分、贪心
D. Examstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasiliy has an exam period which will continue for原创 2017-12-14 21:56:48 · 221 阅读 · 0 评论 -
CodeForces - 231B Magic, Wizardry and Wonders
B. Magic, Wizardry and Wonderstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya the Great Magician and原创 2017-11-26 19:26:47 · 314 阅读 · 1 评论 -
CodeForces - 231C To Add or Not to Add
C. To Add or Not to Addtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA piece of paper contains an array原创 2017-11-26 18:34:29 · 393 阅读 · 0 评论 -
二维并查集——CodeForces - 505B Mr. Kitayuta's Colorful Graph
原题链接CodeForces - 505B Mr. Kitayuta’s Colorful Graph 一个无向图包含n个点m条边,顶点编号从1到n。 对于每条边有颜色ci, 连接着顶点 ai 和 b i. 下面有q个询问.每条询问有两个整数 — ui 和 vi.找到满足下面条件的颜色个数: 同一种颜色的路径连接顶点 ui 和 顶点 vi Input 第一行是两个整数 — n an原创 2017-08-11 20:43:20 · 393 阅读 · 0 评论 -
CodeForces - 747C Servers——贪心
C. Serverstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n servers in a laboratory, each of the原创 2017-09-11 15:25:17 · 379 阅读 · 0 评论 -
CodeForces - 330B Road Construction —— 水题
B. Road Constructiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA country has n cities. Initially, the原创 2017-09-27 19:02:46 · 538 阅读 · 0 评论 -
CodeForces - 767A Snacktower
A. Snacktowertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAccording to an old legeng, a long time ago A原创 2017-09-26 23:37:06 · 409 阅读 · 0 评论 -
codeforce 698A Vacations——贪心——动态规划
A. Vacationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya has n days of vacations! So he decided to原创 2017-09-10 10:55:46 · 227 阅读 · 0 评论 -
CodeForces - 750B New Year and North Pole——思维
[CodeForces - 750B New Year and North Pole](http://codeforces.com/problemset/problem/750/B)B. New Year and North Poletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputou原创 2017-09-07 21:56:06 · 360 阅读 · 0 评论