![](https://img-blog.csdnimg.cn/20190927151117521.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
竞赛算法练习
一些常见的算法练习 , 用以复习思路
FACELESS VOID
这个作者很懒,什么都没留下…
展开
-
无重复字符的最长子串
https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/用tmp 表示 以 s[i] 结尾的串的长度用 f 数组表示这个字符是否出现过如果s [i] 出现过 ,就用min(tmp + 1 , i - last[num]); 这一句 去除标记的影响解释 : 如 abbcdea , 答案是5,看最后一个a ,因为a之前出现过, 要直接用 i - last[num] 必然错, 因为ab bcde原创 2021-09-12 14:33:04 · 69 阅读 · 0 评论 -
L2-014 列车调度 (最简单易懂 ! 核心代码仅3行)
题目链接题意:可能题目没有说清楚 ,但通过模拟样例 我们可以发现, 一旦火车进入了一个调度轨道, 它就不能再倒回出发点了!思路引导:对于样例:第一辆 : 8 此时只有一辆火车, 随便进入一条轨道,等到9号先走他才能走第二辆 : 4 该车的编号比8小, 可以停到8的后面 , 节省轨道数量第三辆 : 2 该车可以停到 4 的后面第四辆 : 5 此时发现5要比头三辆火车(8 4 2 )的最后一个 — 2 号 大 , 所以无法停在2 号后面(如果停了 , 就永远也不会 降序 从出口出去, 毕竟题意是原创 2021-03-26 18:24:58 · 122 阅读 · 0 评论 -
CodeForces 1354A
题目链接:https://codeforces.com/contest/1354/problem/A解释都在注释里,#include <iostream>#include <cstdio>#include <algorithm>using namespace std;int t ;int main(){ scanf("%d" ,&t); while(t--){ long long a, b, c, d ,sum,原创 2020-10-12 19:14:44 · 98 阅读 · 0 评论 -
打脸题
链接:https://ac.nowcoder.com/acm/contest/6871/C来源:牛客网题目描述我们认为,假如一句话里含有 2 ,那么这句话很二次元。同时,二次元浓度由二次元话的数量占比 决定。现在爵士 Sabit 给你看了一眼群里的聊天记录,希望可以知道群里的二次元浓度是多少。输入描述:第一行输入一个整数 T (1≤T≤100),表示数据的组数。对于每组数据:第一行输入一个整数 n (1≤n≤200),表示聊天记录的条数。接下来 n 行每一行输入一个长度不超过 100原创 2020-08-05 20:35:06 · 167 阅读 · 0 评论 -
2020-08-05
链接:https://ac.nowcoder.com/acm/contest/6871/B来源:牛客网题目描述在遥远的斯卡布罗集市,有机分子只能由 C, H, O 三种元素组成。根据珂学家们的探测,一个 C 原子的式量为 13 ,一个 H 原子的式量为 1 ,一个 O 原子的式量为 17 。一个有机分子的式量恰为各个原子的式量的总和。对于有机分子式给出如下定义:有机分子式只可能包含数字、括号和 C, H, O 三种元素标记;数字只能出现在元素标记或右括号的右边,代表该元素(或括号内的分子式)重复原创 2020-08-05 19:42:51 · 173 阅读 · 0 评论 -
第 45 届国际大学生程序设计竞赛(ICPC)亚洲网上区域赛模拟赛 Easy Equation
链接:https://ac.nowcoder.com/acm/contest/8688/A来源:牛客网You are given four positive integers ????, ????, ????, ????, please help little M calculate the number of equations ???? + ???? + ???? = ???? when 0 ≤ ???? ≤ ????, 0 ≤ ???? ≤ ????, 0 ≤ ???? ≤ ????, 0 ≤ ?原创 2020-10-31 19:42:49 · 1615 阅读 · 0 评论 -
codeforces 1084c
这一题要用到乘法原理,就是https://blog.csdn.net/weixin_30468137/article/details/95173439有介绍#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>using namespace std;long long ans = 1;int mod = 1e9 + 7;long long seg[原创 2020-09-20 23:50:12 · 77 阅读 · 0 评论 -
Find a way
Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.Yifenfei’s home is at the countryside, but Merceki’s home is in the center of city. S原创 2020-09-04 17:26:48 · 85 阅读 · 0 评论 -
Fire Game
Fire GameFat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start to fire all the grass. Firstly they choose tw原创 2020-09-02 15:44:00 · 1741 阅读 · 0 评论 -
2020-09-02
H - Pots POJ - 3414You are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i) fill the pot i (1 ≤ i ≤ 2) from the tap;DROP(i) empty the pot i to the drain;POUR(i,j) pour fr原创 2020-09-02 12:18:31 · 95 阅读 · 0 评论 -
Dungeon Master
You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot move diagonally and原创 2020-07-08 15:12:11 · 91 阅读 · 0 评论