Codeforces
_执念_
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Codeforces 989A:A Blend of Springtime
A. A Blend of Springtimetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhen the curtains are opened, a canvas unfolds outside. Kanno marvels at al...原创 2018-06-14 17:03:35 · 326 阅读 · 0 评论 -
Codeforces 893A:Chess For Three(模拟)
题目链接:http://codeforces.com/problemset/problem/893/A题意Alex,Bob,Carl三人下棋,每次只能两个人进行下棋,要求输的那个人当旁观者,然后给出n个输赢情况,1代表Alex赢,2代表Bob赢,3代表Carl赢,判断给出的这n中情况是否符合事实思路模拟,因为第一场是Alex和Bob进行,所以设置三个变量,分别代表该场的胜者,败...原创 2018-08-24 08:58:33 · 345 阅读 · 0 评论 -
Codeforces 766C:Mahmoud and a Message(DP)
题目链接:http://codeforces.com/problemset/problem/766/C 题意有一个长度为n的字符串,第二行有26个数字,位置1~26对应为a~z的字母,数值表示该字母不能出现在长度超过该值的子串中。求有多少种划分该字符串的方法 求该字符串划分成子串后最大的子串的长度 求该字符串划分成满足要求的子串需要至少划分多少次AC代码#include...原创 2018-08-17 14:58:41 · 173 阅读 · 0 评论 -
Codeforces 978E:Bus Video System
题目链接:http://codeforces.com/problemset/problem/978/E题意一辆公交车,在每站会上一些人或下一些人,车的最大容量为w,问初始车上可能有的乘客的情况数。思路找到公交车在路上的最大乘客数和最小乘客数,然后计算最大容量减去最大乘客数,加上最小乘客数的值。如果该值小于0,输出0AC代码#include <stdio.h>...原创 2018-08-15 09:20:12 · 184 阅读 · 0 评论 -
Codeforces 1080C- Masha and two friends
AC代码#include <bits/stdc++.h>#define ll long longconst int maxn=1e6+10;using namespace std;inline ll paintw(ll x1,ll y1,ll x2,ll y2){ ll n=x2-x1+1; ll m=y2-y1+1; // 左下角是黑色,向下取整 if((x1+...原创 2018-12-02 16:20:40 · 241 阅读 · 0 评论 -
Codeforces 215D. Hot Days(贪心)
题意有nnn个地区和mmm个学生,在第iii个地区时,车上有kik_iki个学生,车内温度(当前城市的温度tit_iti+当前车上的学生kik_iki)不能超过TiT_iTi,否则,赔偿每个学生xix_ixi元,没经过一个地方,要花费costicost_icosti元,求通过nnn个地区所需要的最少花费(车上可以坐无限多的人,每经过一个地方,学生可以不坐在车上)思路如果当前城...原创 2018-12-04 19:11:51 · 256 阅读 · 0 评论 -
Codeforces 977D: Divide by three, multiply by two(暴力)
题意有nnn个无序的数,对这些数进行排列,要求ai=3×ai+1a_i=3\times a_{i+1}ai=3×ai+1或2×ai=ai+12\times a_i=a_{i+1}2×ai=ai+1,保证这些数有解,输出排序后的数AC代码/*************************************************************************...原创 2018-12-09 17:41:37 · 189 阅读 · 0 评论 -
Codeforces 977E:Cyclic Components(并查集)
题意给出nnn个顶点和mmm条边,求这个图中环的个数思路利用并查集的性质,环上的顶点都在同一个集合中在输入的时候记录下来每个顶点的度数,查找两个点相连,且度数均为222的点,如果这两个点的父节点相同,表示这两个点在一个环中,环的个数+1+1+1AC代码/******************************************************************...原创 2018-12-09 18:04:33 · 246 阅读 · 0 评论 -
Codeforces 1105B:Zuhair and Strings(字符串水题)
time limit per test: 1 secondmemory limit per test: 256 megabytesinput: standard inputoutput: standard outputGiven a string sss of length nnn and integer k (1≤k≤n)k\ (1≤k≤n)k (1≤k≤n). ...原创 2019-01-21 11:28:00 · 798 阅读 · 0 评论 -
Codeforces 1105C: Ayoub and Lost Array(递推)
time limit per test: 1 secondmemory limit per test: 256 megabytesinput: standard inputoutput: standard outputAyoub had an array aaa of integers of size nnn and this array had two interesting pro...原创 2019-01-21 11:43:10 · 561 阅读 · 0 评论 -
Codeforces 919D:Substring(拓扑排序+DP)
D. Substringtime limit: per test3 secondsmemory limit: per test256 megabytesinputstandard: inputoutputstandard: outputYou are given a graph with nnn nodes and mmm directed edges. One lowercase l...原创 2019-02-14 16:59:41 · 460 阅读 · 0 评论 -
Codeforces 1073C:Vasya and Robot(二分)
C. Vasya and Robottime limit per test: 1 secondmemory limit per test: 256 megabytesinput: standard inputoutput: standard outputVasya has got a robot which is situated on an infinite Cartesian plan...原创 2019-02-15 22:28:45 · 379 阅读 · 0 评论 -
Codeforces 1073D:Berland Fair(模拟)
time limit per test: 2 secondsmemory limit per test: 256 megabytesinput: standard inputoutput: standard outputXXI Berland Annual Fair is coming really soon! Traditionally fair consists of nnn booth...原创 2019-02-15 22:51:55 · 274 阅读 · 0 评论 -
Codeforces 1113C: Sasha and a Bit of Relax(位运算|异或)
time limit per test: 1 secondmemory limit per test: 256 megabytesinput: standard inputoutput: standard outputSasha likes programming. Once, during a very long contest, Sasha decided that he was a b...原创 2019-02-17 22:12:36 · 426 阅读 · 0 评论 -
Codeforces1132A——Regular Bracket Sequence(水题)
Regular Bracket Sequencetime limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard outputA string is called bracket sequence if it does not contain any c...原创 2019-03-15 11:21:37 · 480 阅读 · 0 评论 -
Codeforces 339B:Xenia and Ringroad(水题)
time limit per test : 2 secondsmemory limit per test : 256 megabytesinput : standard inputoutput : standard outputXenia lives in a city that has nnn houses built along the main ringroad. The rin...原创 2019-03-26 16:40:05 · 309 阅读 · 0 评论 -
Codeforces 520B:Two Buttons(思维,好题)
题目链接:http://codeforces.com/problemset/problem/520/B题意给出两个数n和m,n每次只能进行乘2或者减1的操作,问n至少经过多少次变换后能变成m思路在百度之前用了各种方法,dfs,递推什么的能用的全用了,最后都WA在了第七组百度了一下,看到了大佬们的代码震精了!!!竟然只有一行!!用逆推,把从n变成m转换成从m变成n。如...原创 2018-08-13 21:47:37 · 636 阅读 · 0 评论 -
Codeforces 1005D:Polycarp and Div 3
题目链接:http://codeforces.com/problemset/problem/1005/D 题意 给出个字符串(全是数字),把这个字符串换分成一些子串,最多能划分多少个能够被3整除的子串(字符串去掉前导零,0能被3整除)AC代码#include <stdio.h>#include <string.h>#include <io...原创 2018-08-11 20:11:39 · 170 阅读 · 0 评论 -
Codeforces 1006C:Three Parts of the Array(前缀和+map)
题目链接:http://codeforces.com/problemset/problem/1006/C (优快云又改版了,复制粘贴来过来的题目没有排版了,好难看,以后就截图+题目链接了)题目截图:题意:一个长度为n的数组,按顺序分成三部分,要求第一部分和第三部分元素的和相等(每一部分都可以没有元素,没有元素的部分元素和为0),求出第一部分和第三部分最大的相等的元素和,如果没有输...原创 2018-07-17 09:28:18 · 302 阅读 · 0 评论 -
Codeforces 158B:Taxi
B. Taxitime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter the lessons n groups of schoolchildren went outside and decided to visit Polycarpus t...原创 2018-07-14 10:11:38 · 721 阅读 · 0 评论 -
Codeforces 606-C:Sorting Railway Cars(LIS)
C. Sorting Railway Carstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn infinitely long railway has a train consisting of n cars, numbered from ...原创 2018-07-12 11:40:42 · 283 阅读 · 0 评论 -
Codeforces 990B :Micro-World
B. Micro-Worldtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a Petri dish with bacteria and you are preparing to dive into the harsh mic...原创 2018-06-14 16:39:05 · 304 阅读 · 0 评论 -
Codeforces Round #224 (Div. 2) A. Ksenia and Pan Scales
A. Ksenia and Pan Scalestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputKsenia has ordinary pan scales and several weights of an equal mass. Ksenia...原创 2018-04-16 21:34:02 · 191 阅读 · 0 评论 -
【codeforces】Bear and Three Balls(排序,去重)
Bear and Three BallsTime Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionLimak is a little polar bear. He has n balls, the i-th ball has ...原创 2018-01-29 09:50:18 · 250 阅读 · 0 评论 -
Codeforces 580B: Kefa and Company(前缀和)
http://codeforces.com/problemset/problem/580/B题意:Kefa有n个朋友,要和这n个朋友中的一些出去,这些朋友有一些钱,并且和Kefa有一定的友谊值,要求这些朋友间的贫富差距(拥有的钱的数量)小于d,要求Kefa邀请出来的朋友的友谊值和最大,并输出这个最大值。#include <stdio.h>#include <str...原创 2018-07-20 11:32:50 · 753 阅读 · 0 评论 -
Codeforces 133A:HQ9+
A. HQ9+time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHQ9+ is a joke programming language which has only four one-character instructions:"H" prin...原创 2018-07-14 21:39:10 · 268 阅读 · 0 评论 -
Codeforces 148B: Escape
题目链接:http://codeforces.com/problemset/problem/148/B题意:公主从龙的洞穴中逃跑,公主的速度为vp,龙的速度为vd,在公主逃跑时间t时,龙发现公主逃跑并开始追公主。公主每丢弃一块宝石,龙需要花f小时整理并送回洞穴,然后再去追公主,公主在离洞穴距离为c的时候就安全了,求公主在逃跑过程中需要丢弃的宝石数#include <stdio....原创 2018-07-20 15:23:14 · 199 阅读 · 0 评论 -
Codeforces 106A:Card Game
题目链接http://codeforces.com/contest/106/problem/A题意:一套牌有S、H、D、C四种花色,按等级分成6、7、8、9、T、J、Q、K、A。每次选出一个花色作为无敌的花色(属于这个花色的牌可以打败所有不属于这个花色的牌,无视等级)。第一张牌打败第二张牌的情况有:1。第一张牌是无敌的花色,第二张牌不是2。第一张牌和第二张牌的花色相同,并且第一...原创 2018-07-20 16:56:03 · 253 阅读 · 0 评论 -
Codeforces 1009C: Annoying Present
C. Annoying Presenttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice got an array of length nn as a birthday present once again! This is the t...原创 2018-07-15 16:48:55 · 471 阅读 · 0 评论 -
Codeforces 1009D:Relatively Prime Graph
D. Relatively Prime Graphtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's call an undirected graph G=(V,E)G=(V,E) relatively prime if and onl...原创 2018-07-15 18:01:44 · 476 阅读 · 0 评论 -
Codeforces 617B:Chocolate(思维)
题目链接http://codeforces.com/problemset/problem/617/B题意有一个数组,数组中的元素均为0或1 。要求将这个数组分成一些区间,每个区间中的1的个数均为1。问有多少种分法思路将数组中的0全部去掉,用一个数组记录原数组中的每个1的位置,相邻的两个1的位置差为两个1之间的0的个数,让这些0的个数一次相乘就行了。但是要注意原数组中全是0的情况...原创 2018-07-26 16:19:58 · 209 阅读 · 0 评论 -
Codeforces 208A:Dubstep(字符串)
题目链接:http://codeforces.com/problemset/problem/208/A题意给出一个字符串,将字符串中的WUB给删去,如果两个字母间有WUB,则这两个字母用空格隔开AC代码#include <stdio.h>#include <string.h>#include <iostream>#include ...原创 2018-07-26 16:57:40 · 390 阅读 · 0 评论 -
Codeforces 698A:Vacations(DP)
题目链接:http://codeforces.com/problemset/problem/698/A题意Vasya在n天中,有三件事情可以做,健身、比赛或者休息,但是不能连续两天都是比赛或都是但是健身,但是连续休息两天是允许的,问题是在这n天中,Vasya最少可以休息几天?0代表休息,1代表比赛,2代表健身,3可以代表比赛也可以代表健身思路用数组dp[i][j]表示第i天...原创 2018-08-02 17:14:23 · 287 阅读 · 0 评论 -
Codeforces 189A:Cut Ribbon(完全背包,DP)
time limit per test : 1 secondmemory limit per test : 256 megabytesinput : standard inputoutput : standard outputPolycarpus has a ribbon, its length is nnn. He wants to cut the ribbon in a way t...原创 2019-04-01 20:12:59 · 396 阅读 · 0 评论
分享