题解p9580 round game

Educational Codeforces Round 149 (Rated for Div. 2)

# A. Grasshopper on a Line ```cpp #include using namespace std; #define int long long void solve(){ int x , k; cin >> x >> k; if( x % k == 0 ){ cout > ......
Educational Codeforces Round Rated 149

P9376 题解

首先考虑怎么暴力。 考虑把每个数进行 $B$ 进制分解,然后我们惊奇的发现这两个操作就是把最低位去掉和往最低位后面插入一个数。 然后我们顺藤摸瓜,把每个数的分解扔到 Trie 树上,我们发现我们要找到一个节点,使得所有单词节点到其的距离之和最短,答案就是这个最短距离。 这里直接考虑一个 Trie 树 ......
题解 P9376 9376

「闲话随笔」「DROI」Round 2

# 「闲话随笔」「DROI」Round 2 点击查看目录 > [TOC] 题挺好玩的。 ## [P9373 「DROI」Round 2 构造与取模](https://www.luogu.com.cn/problem/P9373) 发现 $k, n - k$ 即为一组正确构造,$k \ge n - k ......
随笔 Round DROI

CODE FESTIVAL 2016 qual B E 题解

以下 $\Sigma$ 为字符集。 首先单次询问 $O(|\Sigma||S|)$ 的暴力是显然的:建出 trie 树,然后每次把对应的字符串在上边扫,加上对应位置比它小的子树的大小。 然后接下来有两种方法。 ## 正解 首先在线大概是没什么前途的,考虑离线,建出 trie 树之后在上边 dfs,处 ......
题解 FESTIVAL CODE 2016 qual

CF1398E Two Types of Spells 题解 set

题目链接:[https://codeforces.com/problemset/problem/1398/E](https://codeforces.com/problemset/problem/1398/E) ### 题目大意 你有一个集合,初始为空。 有两种类型的元素,一种是普通元素,一种是强化 ......
题解 Spells 1398E Types 1398

第十四届蓝桥杯大赛青少组全国总决赛初级组C++C++题解

## 第十四届蓝桥杯大赛青少组全国总决赛初级组$C++$题解 ### 第一题 给定一个十进制正整数$N(1≤N≤10^9)$,请从小到大输出$1$~$N$之间(含$1$和$N$)所有满足以下要求的数: 1. 这个数转换为八进制后是一个回文数; 2. 这个数是一个平方数。 例如:$N = 20$,在$ ......
蓝桥 题解 总决赛 全国

Codeforces Round 875 (Div. 2) 题解 A ~ D

## [A](https://codeforces.com/contest/1831/problem/A). Twin Permutations ### 题目大意 题目给定一个 $1\sim n$ 的排列 $a$ ,现在想求一个排列 $b$, 使得对于 $i #include #include #d ......
题解 Codeforces Round 875 Div

Codeforces Round 875 (Div. 2) A-D

## A. Twin Permutations 题意:给出一个由[1,2,...,n]组成的数组a,构造另一个由[1,2,...,n]组成的数组b,使得a[1]+b[1]>n; for(int i=1;i>a[i]; } for(int i=1;i>n; for(int i=1;i>a[i]; fo ......
Codeforces Round 875 A-D Div

山东二轮省集题解合集

山东二轮省集题解合集 # Day1 ## A 打表,发现答案是 $\prod\limits_{i=1}^n (2i-1)$。 证明可以考虑拿 GF 推。 首先有 dp,$f(i,j)$ 表示到第 $i$ 个括号当前左括号减右括号的个数为 $j$,转移是简单的 $f(i,j)=f(i,j+1)+f(i ......
题解

欢乐结训赛题解

# 欢乐结训赛题解 ## [A 题目链接](https://vjudge.net/problem/CodeForces-1760B/origin) - 题目大意 ``` 给你一个字符串,让你求字符串中最大的字母在字母表中排第几 例如 codeforces 中 s 的是最大的 s在字母表中排 19位 ......
题解

Codeforces Round 875 (Div

# Codeforces Round 875 (Div. 2) C-D题解 ### C [Problem - C - Codeforces](https://codeforces.com/contest/1831/problem/C) 我们发现题述所形成的父亲节点一定比子节点先画出,并且如果子节点顺 ......
Codeforces Round 875 Div

Codeforces Round 875 (Div. 2)

# Preface 难得现场打一次,这天下午打了三个半小时的校内赛,然后八点打了两小时ARC,最后再接上两个半小时的CF真是爽歪歪 不过有一说一其实很多时候都在坐牢,这场CF也差不多,一个小时写完ABCD然后开始坐牢,其实E基本想出来了但是没想到用随机赋值的方法来实现 不过由于这场手很稳因此排名极高 ......
Codeforces Round 875 Div

第十二届蓝桥杯c++b组国赛题解(还在持续更新中...)

### 试题A:带宽 ![image](https://img2023.cnblogs.com/blog/3026527/202305/3026527-20230529165827607-1040715171.png) **解题思路:** >由于小蓝家的网络带宽是200Mbps,即200Mb/s,所 ......
蓝桥 题解

题解PKUCPC2023 C Empty up a Bottle

# 题解PKUCPC2023 C Empty up a Bottle 感觉这道题目好厉害啊。 题意就是有三个瓶子 ABC,每个瓶子里面都初始装有 $M_A,M_B,M_C$ 单位体积的水,每次你可以选择将一个瓶子中倒水到另外一个瓶子,你必须保证另外一个瓶子装水量恰好翻倍,请使用若干次操作使得一个瓶子 ......
题解 PKUCPC Bottle Empty 2023

Codeforces Round 874 (Div. 3)

# A. Musical Puzzle ```cpp #include using namespace std; void solve(){ int n; string s; cin >> n >> s; set cnt; for( int i = 0 ; i + 1 > t; while( t - ......
Codeforces Round 874 Div

Codeforces Round 875 (Div. 2) A-D

# Codeforces Round 875 (Div. 2) ## A. Twin Permutations ```c++ int a[N]; void solve(){ int n=read(); for(int i=1;i0?"YES":"NO"); //puts(ans>0?"Yes":"N ......
Codeforces Round 875 A-D Div

Codeforces Round #875 (Div. 2)

# Codeforces Round #875 (Div. 2) [bilibili: Codeforces Round #875 (Div. 2) 实况 | 完成度 \[4.01 / 6\]](https://www.bilibili.com/video/BV1bo4y137he) ## A `` ......
Codeforces Round 875 Div

Codeforces Round 875 (Div. 2) A~D

# Codeforces Round 875 (Div. 2) A~D ### A. Twin Permutations 构造$a[i]+b[i]=n+1$ ```c++ void work() { int n; cin >> n; rep (i, 1, n) { int x; cin >> x; ......
Codeforces Round 875 Div

[ARC161A] Make M 题解

# [ARC161A] Make M 题解 ## Link [洛谷](https://www.luogu.com.cn/problem/AT_arc161_a) [AtCoder](https://atcoder.jp/contests/arc161/tasks/arc161_a) ## Descr ......
题解 161A Make ARC 161

2023.5.28「DROI」Round 2 解题报告

# 「DROI」Round 2 ## 期望得分 T1 : $100$pts , T2 : $30$pts , T3:$10$pts , T4:$0$pts ## 实际得分 因为是 IOI 赛制,提交了就能看到分数,所以也是这个分数 ## 用时情况 T1 : $20$min , T2:$2.5$h , ......
报告 Round 2023 DROI 28

[PKUCPC2023] J. Hat Puzzle 题解

题目链接:http://poj.openjudge.cn/campus2023/J/ 很荣幸参与了命题。 题解的 ppt 版本在这儿:https://disk.pku.edu.cn:443/link/E4B484E7F3C58A45E9E4FB19C731BF4E,有效期限:2028-01-01 2 ......
题解 PKUCPC Puzzle 2023 Hat

AtCoder Beginner Contest 303 题解 A - E

## [A](https://atcoder.jp/contests/abc303/tasks/abc303_a) - Similar String ### 题目大意 忽略`0`和`o`的差别以及`1`和`l`的差别比较两个字符串。 ### 解题思路 1. 可以硬求,直接写个超长的if判断一下。 2 ......
题解 Beginner AtCoder Contest 303

AtCoder Beginner Contest 303 G Bags Game

[洛谷传送门](https://www.luogu.com.cn/problem/AT_abc303_g "洛谷传送门") [AtCoder 传送门](https://atcoder.jp/contests/abc303/tasks/abc303_g "AtCoder 传送门") 经典题,考虑区间 ......
Beginner AtCoder Contest Bags Game

Atcoder Beginner Contest ABC303 题解

题目: 。 # A 挨个判断。 # B 暴力枚举两个人是否会 in bad mood。 # C 用 map 或者 set 记录回血的位置。 # D 考虑 dp。 $f_{i,[0,1]}$ 表示当前到 $i$,是否开了大写锁定的方案数。 转移: ```cpp if(s[i]=='A'){ f[i][ ......
题解 Beginner Atcoder Contest ABC

Educational Codeforces Round 149 (Rated for Div.2) 题解 A~D

## [A](https://codeforces.com/contest/1837/problem/A). Grasshopper on a Line ### 题目大意 给定两个整数 $x$ 和 $k$,我们需要规划一条路线,从 $(0,0)$ 走到 $(0, x)$,同时满足我们每次走的距离不能 ......
题解 Educational Codeforces Round Rated

P9356 「SiR-1」Bracket 题解

# P9356 「SiR-1」Bracket 题解 首先我们来先考虑一下如何计算一个给定的 $f(s[1,n])$。 一般括号序列的题目都是比较套路的将 $\texttt{(}$ 赋值为 $1$,将 $\texttt{)}$ 赋值为 $-1$,然后求一下前缀和记为 $sum_i$,那么一个括号序列是 ......
题解 Bracket P9356 9356 SiR

LeetCode-Java题解 977. Squares of a Sorted Array

题目地址:[977. Squares of a Sorted Array](https://leetcode.cn/problems/squares-of-a-sorted-array/) 解题思路: 又是一道双指针的题目,看见秒想到双指针(平方直接调用sort方法也行,但是这么写这题就没意思了)。 ......
题解 LeetCode-Java LeetCode Squares Sorted

死循环Game

package com.karl; import java.util.Random; import java.util.Scanner; public class GameDemo { public static void main(String[] args) { //1.生成一个随机号码 Ran ......
Game

Gym102978C Count Min Ratio 题解

赛时无人场切。震撼,震撼。学到许多。全程贺 zak。 首先我们套路推下式子。枚举左边的红蓝球个数,答案即为 $$ \begin{aligned} &\sum_{b=0}^B\sum_{r=0}^R\binom{b+r}b\binom{B-b+R-r}{B-b}\min(\frac rb,\frac{ ......
题解 102978C 102978 Count Ratio

#296. 最强大脑 题解

2021-09-22 22:16:56 星期三 # #296. 最强大脑 题解 这是一道非常简单的`bfs`水题。。。。但是为什么没有人做呢? ~~难道是因为网上搜不到?~~ ## 理解题意: 输入为 **2** 个 `n * m` 大小矩阵。 第一个矩阵表示每个点的**分数值**, 第二个矩阵则表 ......
题解 大脑 296