
ACM的进阶之路
文章平均质量分 85
此专栏将记录一个ACM菜鸡的进阶之路,希望可以帮助到新入ACM坑的同学。此专栏将会系统的讲解ACM的学习过程,并且会列出各大OJ的部分题解。虽然玩ACM路漫漫其修远兮,但要相信长风破浪会有时。
Ever_glow
当命运需要你逆风飞翔的时候,就不能随风而去。
展开
-
Codeforces Round #440 (Div. 2, based on Technocup 2018 Elimination Round 2) A-C题解
A. Search for Pretty Integerstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two lists of non-zero digits.Let's call an integer pretty if its (base 10) representation has at least on原创 2017-10-17 12:56:21 · 598 阅读 · 0 评论 -
Codeforces Round #441 (Div. 2, by Moscow Team Olympiad) A-D题解
A. Trip For Mealtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputWinnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and原创 2017-10-17 12:27:11 · 766 阅读 · 0 评论 -
Codeforces Round #436 (Div. 2) A-D题解
Codeforces Round #436 (Div. 2) A. Fair GameB.Polycarp and LettersC. BusD. Make a Permutation!原创 2017-09-27 13:19:55 · 889 阅读 · 0 评论 -
Codeforces Round #430 (Div. 2) 签到题
传送门:点击打开链接A. Kirill And The Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKirill plays a new c原创 2017-09-01 19:06:58 · 884 阅读 · 0 评论 -
Educational Codeforces Round 27 A—D 题解
这里是传送门A. Chess Tourneytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputBerland annual chess tournament原创 2017-08-23 15:54:44 · 1081 阅读 · 0 评论 -
GYM 101086 A,F,G,H,L 题解
A. My Friend of Miserytime limit per test3.0 smemory limit per test256 MBinputstandard inputoutputstandard outputWith the SCPC2015 getting closer, Noura Boubou,原创 2017-08-16 19:30:34 · 1421 阅读 · 0 评论 -
中石油 暑期集训个人赛 水题部分
签到题A问题 A: 公鸡打鸣时间限制: 1 Sec 内存限制: 128 MB提交: 292 解决: 85[提交][状态][讨论版]题目描述鸡国中有两只最喜欢打鸣的公鸡 G1 和 G2,它们每一次打鸣都有一个声音的响度值。一天清晨,G1 开始先开始打鸣,响度值为 x,G2 听到 G1 的打鸣后也开始打鸣,响度值为y。G1 和 G2 很想把它们打鸣声音的响度值调原创 2017-07-25 15:30:46 · 851 阅读 · 1 评论 -
HDU 2700 Parity (水题)
ParityTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4802 Accepted Submission(s): 3609Problem DescriptionA bit string has odd parity if the number of 1's is odd. A bit string has even pari原创 2017-06-04 08:10:34 · 479 阅读 · 0 评论 -
HDU 1014 Uniform Generator
题目地址:点击打开链接经过了前几个题的折磨后,迎来了几个愉悦身心的水题。题目意思是 给你两个数,利用公式求出从0到n-1的数是不是都在求出的数组内。不得已用c输出,话说这输出格式也是恶心。代码实现:#include#include#includeusing namespace std;int main(){ long long int m,n,i; i原创 2017-05-12 13:50:37 · 409 阅读 · 0 评论 -
HDU 1013 Digital Roots
题目链接:点击打开链接这题也是可以,没告诉n多大,那你让我怎么猜呢?只好用字符串吸收,随便开的字符串,幸好过了。线性时间,当sum>9时,就可以把sum拆分,形成新的sum,最后输出。线性时间,我还能超时。。。n[0]=='0',写成了n[0]=0...花样 !AC代码实现:#include#include#include#includeusing names原创 2017-05-12 11:43:04 · 393 阅读 · 1 评论 -
HDU 1012 u Calculate e
题目地址:点击打开链接又是水题,好兴奋。直接放代码,不解释。代码实现:#include#include#include#includeusing namespace std;int main(){ double e; long long int i,temp; e=temp=1; cout<<"n e"<<endl; cout<<"- ------原创 2017-05-12 10:10:47 · 556 阅读 · 0 评论 -
HDU 1008 Elevator
题目链接:点击打开链接好不容易碰到的水题呀。你在电梯上,电梯上去6s,电梯下去4s,电梯不动5s,不存在优先等级,电梯就这么简简单单的走,问最后的总时间是多少。。这种水题我都不敢写,题目越水越不会。还有 能用long long 为什么要写int,所以我的代码都是long long.代码实现:#include#include#include#includeu原创 2017-05-11 20:04:56 · 360 阅读 · 0 评论 -
山东省第七届ACM大学生程序设计竞赛 字符串倒置
Reversed WordTime Limit: 1000 MSMemory Limit: 131072 KDescriptionSome aliens are learning English. They have a very strange way in writing that they revered e原创 2017-03-25 16:02:07 · 480 阅读 · 0 评论 -
山东理工大3561 斐波那契数列
FibonacciTime Limit: 2000MS Memory Limit: 131072KBProblem DescriptionFibonacci numbers are well-known as follow: Now given an integer N, please find out whether N can be represented as the原创 2017-03-25 14:29:01 · 599 阅读 · 0 评论 -
整数除法
A - Julyed Time Limit: 2000 ms / Memory Limit: 65536 kb Description Julyed is preparing for her CET-6. She has N words to remember, but there is only M days left. If she can’t remember all th原创 2017-03-25 13:32:51 · 661 阅读 · 0 评论 -
CodeForces - 746C 隧道问题
C. Tramtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe tram in Berland goes along a straight line from原创 2017-03-13 19:15:43 · 598 阅读 · 0 评论 -
CodeForces - 746B
B. Decodingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp is mad about coding, that is why he wri原创 2017-03-13 19:11:12 · 649 阅读 · 0 评论 -
CodeForces - 746A 水果问题
A. Compotetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputNikolay has a lemons, b apples and c pears. He原创 2017-03-13 18:58:35 · 626 阅读 · 0 评论 -
小A与欧拉路 (求树的最长路)
题目描述小A给你了一棵树,对于这棵树上的每一条边,你都可以将它复制任意(可以为0)次(即在这条边连接的两个点之间再加一条边权相同的边),求所有可能新形成的图中欧拉路的最短长度欧拉路:从图中任意一个点开始到图中任意一个点结束的路径,并且图中每条边只通过恰好一次输入描述:第一行一个数 n ,表示节点个数接下来 n-1 行,每行三个整数 u,v,w,表示有一条 u 到 v 边权...原创 2019-03-01 11:25:52 · 430 阅读 · 0 评论 -
蓝桥杯 小朋友排队 (树状数组)
小朋友排队 时间限制:1.0s 内存限制:256.0MB问题描述 n 个小朋友站成一排。现在要把他们按身高从低到高的顺序排列,但是每次只能交换位置相邻的两个小朋友。 每个小朋友都有一个不高兴的程度。开始的时候,所有小朋友的不高兴程度都是0。 如果某个小朋友第一次被要求交换,则他的不高兴程度增加1,如果第二次要求他交换,则他的不高兴程度增加2(即不高兴程度为3),依次类推...原创 2019-02-26 15:23:18 · 543 阅读 · 0 评论 -
2018 ACM/ICPC 沈阳站 C Insertion Sort
题目描述Insertion sort is a simple sorting algorithm that builds the final sorted array one item at an iteration.More precisely, insertion sort iterates, consuming one input element each repetition, an...原创 2018-11-19 09:34:24 · 1338 阅读 · 1 评论 -
2018 ACM/ICPC 沈阳站 J How Much Memory Your Code Is Using?
题目描述In the C++ language, the values of variables are stored somewhere in the computer memory as zeros and ones. Our program does not need to know the exact location where a variable is stored since ...原创 2018-11-19 09:13:22 · 1140 阅读 · 2 评论 -
2018 ACM/ICPC 南京站 & GYM 101981
A Adrien and Austin给定一堆石子,每个人可以从其中连续的拿出一段,最优情况下,问最后谁能获得游戏的胜利。需要注意的是,当n==0时,此时先手是无法取石子的,此时输出Austin代码实现:/*Look at the starLook at the shine for U*/#include<bits/stdc++.h>#define ll ...原创 2018-11-18 14:52:00 · 734 阅读 · 0 评论 -
ACM-ICPC北京赛区2018 I Palindromes (打表规律)
时间限制:1000ms单点时限:1000ms内存限制:512MB描述Recently, Nvoenewr learnt palindromes in his class.A palindrome is a nonnegative integer that is the same when read from left to right and when read from ri...原创 2018-11-14 09:01:58 · 1011 阅读 · 0 评论 -
ACM-ICPC北京赛区2018 D Frog and Portal(构造)
时间限制:1000ms单点时限:1000ms内存限制:512MB描述A small frog wants to get to the other side of a river. The frog is initially located at one bank of the river (position 0) and wants to get to the other bank...原创 2018-11-13 21:29:32 · 459 阅读 · 0 评论 -
【SCOI2009】最长距离 (SPFA)
题目描述windy有一块矩形土地,被分为 N*M 块 1*1 的小格子。 有的格子含有障碍物。 如果从格子A可以走到格子B,那么两个格子的距离就为两个格子中心的欧几里德距离。 如果从格子A不可以走到格子B,就没有距离。 如果格子X和格子Y有公共边,并且X和Y均不含有障碍物,就可以从X走到Y。 如果windy可以移走T块障碍物,求所有格子间的最大距离。 保证移走T块障碍物以后,至少有一个格子不含...原创 2018-11-11 11:23:39 · 427 阅读 · 0 评论 -
树的最小支配集、最小点覆盖、最大独立集 (贪心orDP)
树的最小支配集:点集中取出尽量少的点,使剩下的点与取出来的点都有边相连。树的最小点覆盖:点集中取出尽量少的点,使得所有边都与选出的点相连。树的最大独立集:点集中取出尽量多的点,使得这些点两两之间没有边相连。贪心模板:#include<bits/stdc++.h>#define ll long long#define sl(x) scanf("%lld",&x)...原创 2018-11-10 16:55:33 · 1048 阅读 · 0 评论 -
BZOJ 1270 [BeijingWc2008]雷涛的小猫 (DP)
【动态规划】雷涛的小猫时间限制: 1 Sec 内存限制: 128 MB提交: 140 解决: 47[提交] [状态] [讨论版] [命题人:admin]题目描述雷涛的小猫雷涛同学非常的有爱心,在他的宿舍里,养着一只因为受伤被救助的小猫(当然,这样的行为是违反学生宿舍管理条例的)。 在他的照顾下,小猫很快恢复了健康,并且愈发的活泼可爱了。可是有一天,雷涛下课回到寝室,却发现小...原创 2018-11-10 12:34:18 · 281 阅读 · 0 评论 -
牛客国庆集训派对Day3 I Metropolis (多源最短路)
题目描述 魔方国有n座城市,编号为。城市之间通过n-1条无向道路连接,形成一个树形结构。在若干年之后,其中p座城市发展成了大都会,道路的数量也增加到了m条。大都会之间经常有贸易往来,因此,对于每座大都会,请你求出它到离它最近的其它大都会的距离。输入描述:第一行三个整数n,m,p (1 ≤ n,m ≤ 2*105,2 ≤ p ≤ n),第二行p个整数表示大都会的编号 (1≤ xi≤...原创 2018-10-03 21:48:23 · 388 阅读 · 0 评论 -
The 2018 ACM-ICPC China JiangSu Provincial Programming Contest B Array (滚动数组+规律)
JSZKC is the captain of the lala team.There are NN girls in the lala team. And their height is [1,N]and distinct. So it means there are no two girls with a same height.JSZKC has to arrange them as...原创 2018-09-25 09:01:50 · 365 阅读 · 0 评论 -
ACM-ICPC 2018 焦作赛区网络预赛 H String and Times (后缀数组+容斥)
Now you have a string consists of uppercase letters, two integers A and B. We call a substring wonderful substring when the times it appears in that string is between A and B (A≤times≤B). Can you calc...原创 2018-09-15 20:11:16 · 561 阅读 · 0 评论 -
ACM-ICPC 2018 焦作赛区网络预赛 L Poor God Water (BM算法)
God Water likes to eat meat, fish and chocolate very much, but unfortunately, the doctor tells him that some sequence of eating will make them poisonous.Every hour, God Water will eat one kind of fo...原创 2018-09-15 20:05:10 · 782 阅读 · 0 评论 -
ACM-ICPC 2018 焦作赛区网络预赛 G Give Candies (欧拉降幂)
There are N children in kindergarten. Miss Li bought them N candies. To make the process more interesting, Miss Li comes up with the rule: All the children line up according to their student number (1...原创 2018-09-15 19:57:35 · 488 阅读 · 0 评论 -
【动态规划】货币面值
【动态规划】货币面值时间限制: 1 Sec 内存限制: 64 MB提交: 124 解决: 48[提交] [状态] [讨论版] [命题人:admin]题目描述魔法世界发行了很多不同面值的纸币,试求出用这些纸币进行任意的组合不能表示的最小面值是多少。输入输入包含多个测试用例,每组测试用例的第一行输入一个整数N(N≤100)表示流通的纸币面额数量,第二行是N个纸币的具体表示面...原创 2018-08-27 21:08:14 · 1412 阅读 · 1 评论 -
2018中国大学生程序设计竞赛 - 网络选拔赛 I Tree and Permutation (dfs计数)
Tree and PermutationTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 821 Accepted Submission(s): 292Problem DescriptionThere are N vert...原创 2018-08-26 19:16:23 · 328 阅读 · 0 评论 -
2018中国大学生程序设计竞赛 - 网络选拔赛 D Find Integer (规律)
Find IntegerTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 293 Accepted Submission(s): 78Special JudgeProblem Descriptionpeople in US...原创 2018-08-25 20:20:35 · 507 阅读 · 1 评论 -
2018中国大学生程序设计竞赛 - 网络选拔赛 C Dream (构造)
DreamTime Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 268 Accepted Submission(s): 3Special JudgeProblem DescriptionFreshmen frequently...原创 2018-08-25 19:42:45 · 539 阅读 · 0 评论 -
2018中国大学生程序设计竞赛 - 网络选拔赛 A Buy and Resell (贪心)
Buy and ResellTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 163 Accepted Submission(s): 39Problem DescriptionThe Power Cube is used ...原创 2018-08-25 19:28:23 · 814 阅读 · 0 评论 -
骰子 (入门概率DP)
【概率】骰子时间限制: 1 Sec 内存限制: 128 MB提交: 14 解决: 10[提交] [状态] [讨论版] [命题人:admin]题目描述众所周知,骰子是一个六面分别刻有一到六点的立方体,每次投掷骰子,从理论上讲得到一点到六点的概率都是1/6。今有骰子一颗,连续投掷N次,问点数总和大于等于X的概率是多少?输入一行两个整数,分别表示n和x,其中1≤N≤24,0≤...原创 2018-08-23 20:27:00 · 5794 阅读 · 2 评论 -
Hello Tarjan ---- Tarjan算法小结
一种由Robert Tarjan提出的求解有向图强连通分量的线性时间的算法。 ------百度百科解读一下这句话,Tarjan算法可以解决存在强连通分量的图,而且是在线性时间内解决。所以,不得不%一下Tarjan,聪明的脑子提供了这么一个神奇的算法。网上关于Tarjan算法(以下简称tarjan)的博客琳琅满目,这里只记录一下我对tarjan的理解,然后就当是做个笔记了。首先所需要的知...原创 2018-08-10 19:47:58 · 1009 阅读 · 0 评论