codeforces country binary ralph

Hey left 1 Codeforces Round 918 (Div. 4)

题目链接 A. 3个数,其中2个数相同,输出不相同的那个 可以用if else判断,较为麻烦 用的map,输出出现一次的 #include <bits/stdc++.h> using namespace std; const int N=1e5+10; void solve(){ map<int,i ......
Codeforces Round left Hey 918

CodeForces 1312G Autocompletion

洛谷传送门 CF 传送门 考虑直接在题目给的 Trie 上 dp,设 \(f_u\) 为打出 \(u\) 结点的串的最小代价。 首先我们有 \(f_u \gets f_{fa_u} + 1\)。 我们有 \(f_u \gets \min\limits_v f_v + t + 1\),要求 \(u\) ......
Autocompletion CodeForces 1312G 1312

Educational Codeforces Round 152 (Rated for Div. 2)

layout: ../../layouts/MarkdownPostLayout.astro title: 'Educational Codeforces Round 152 (Rated for Div. 2)' pubDate: 2024-01-11 description: '一些训练' au ......
Educational Codeforces Round Rated 152

codeforces 918 div4

C 题意 : 给定一些数,问这些数的和是不是完全平方数(5*5这样) #include<cmath> #include<iostream> #define ll long long using namespace std; bool issq(ll n){ ll root = sqrt(n); re ......
codeforces div4 918 div

grep提示"Binary file (standard input) matches"

一、问题现象 [root@test ~]# cat 2e44fc3e1551879f86112ff36ef7671b313a7d0d7ad52ff8b5b080e850e10f50-json.log-20240110 |grep '2024-01-10' Binary file (standard ......
quot standard matches Binary input

CodeForces 1329D Dreamoon Likes Strings

洛谷传送门 CF 传送门 考虑构造一个新串 \(t\),只保留原串 \(s_{i - 1} = s_i\) 的字符 \(s_i\)。设 \(a_i\) 为 \(t_i\) 在原串的位置。 那么新串上我们有两种操作: \(\forall i\),删除 \(t_i\)(相当于删除原串中的 \([a_i, ......
CodeForces Dreamoon Strings 1329D Likes

CodeForces 1237H Balanced Reversals

洛谷传送门 CF 传送门 容易想到把 \(s, t\) 分成长度为 \(2\) 的段考虑。容易发现 \(00, 11\) 的个数在操作过程中不会改变,所以若两串的 \(00\) 或 \(11\) 个数不相等则无解。 考虑依次对 \(i = 2, 4, \ldots, n\) 构造 \(s[1 : i ......
CodeForces Reversals Balanced 1237H 1237

vp Codeforces Round 915 (Div. 2)

vp还是比正式打舒服一些。。AB很顺畅,A题。。我只能说玩MC的都一眼秒了好吧 C题,我卡住了,结论非常好推,我直接退出来了,但是,问题是我对特例的判断不是很熟悉,或者说不是很敏感。这是一个大问题,我在wa on test 2的时候,第一反应是去看看这个算法整个有没有什么问题,事实上是没有的那么问题 ......
Codeforces Round 915 Div vp

Codeforces [Hello 2024]

Codeforces Hello 2024 主打一个昏了头 A. Wallet Exchange #include <bits/stdc++.h> #define endl '\n' //#define int long long using namespace std; const int N = ......
Codeforces Hello 2024

CodeForces 1379E Inverse Genealogy

洛谷传送门 CF 传送门 \(n\) 为偶数显然无解。 否则我们可以构造一棵 \(n\) 个点的完全二叉树,当 \(n + 1\) 是 \(2\) 的幂时满足 \(m = 1\),否则 \(m = 0\)。 当 \(n \ge 5\) 时可以递归至 \((n - 2, m - 1)\),再挂一个叶子 ......
CodeForces Genealogy Inverse 1379E 1379

CodeForces 1919F2 Wine Factory (Hard Version)

洛谷传送门 CF 传送门 题目看着感觉很像最大流,不妨建模,\(S \to i\),容量为 \(a_i\);\(i \to T\),容量为 \(b_i\);\(i \to i + 1\),容量为 \(c_i\)。答案是这个图的最大流。 考虑最大流转最小割。观察到 \(S \to i\) 和 \(i ......
CodeForces Factory Version 1919F2 1919F

CodeForces 1919E Counting Prefixes

洛谷传送门 CF 传送门 考虑一个很类似的题。我们把正数和负数分开来考虑,最后用 \(0\) 连接一些连续段,形如 \(0 - \text{正} - 0 - \text{正} - 0 - \text{负}\)。 先考虑正数。设 \(f_{i, j}\) 为考虑了 \(\ge i\) 的正数,形成了 ......
CodeForces Counting Prefixes 1919E 1919

【题解】Codeforces 1876G Clubstep

首先考虑暴力的贪心。 从 \(r\) 到 \(l\) 依次遍历,若 \(a_i < x\) 则一直进行题目中的操作。 正确性是能保证的,因为选后面的 \(j\) 只能 \(+ 1\),而选 \(i\) 可以 \(+2\),且 \(i\) 前面的部分都是 \(+1\)。 考虑转化一下,把对 \(i\) ......
题解 Codeforces Clubstep 1876G 1876

【题解】Codeforces 1852D Miriany and Matchstick

首先考虑到第一行是固定的,先去掉第一行的贡献。 接下来会有一个 \(O(n^2)\) 的 \(\text{DP}\)。 考虑设 \(f_{i, 0 / 1, j}\) 为考虑了 \(1\sim i\) 列的放置,第 \(i\) 列填 \(\text{A / B}\) 且对数为 \(j\) 是否可行。 ......
题解 Codeforces Matchstick Miriany 1852D

二叉树 Binary tree

目录 已经有数组、链表了,为什么还需要二叉树? 假设你需要存储一些公司的职位信息,什么数据结构能在保证顺序的同时,又能快速完成查找、插入和删除呢? 有序数组和哈希表都做不到这一点。 这时就该二叉查找树出场了。 ......
Binary tree

Maximum Depth of Binary Tree

Source Problem Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the rootnode down to ......
Maximum Binary Depth Tree of

vp Educational Codeforces Round 160 (Rated for Div. 2)

ABC很顺畅,没有卡住然后到最后D都做不出来 D我感觉是一个类似计数dp的东西但是我找不到统计的规律但是可以得到一些性质:一个数字如果想被删掉,那它直到它左边的比它小的数字为止所有数字都要先删掉,它才能被删掉 发现自己如果不去想DP,会去往贪心的方向想,这题就是那种贪心没法完全被判断掉的因为贪心也有 ......
Educational Codeforces Round Rated 160

codeforces比赛(4):codeforces hello_2024

A、Wallet Exchange 跳转原题点击此:A题地址 1、题目大意 经典贪心:A和B玩游戏,两人依次进行以下两个操作(注意这两个操作是依次进行,而不是选择操作!!!)是:1、交换钱包或保留钱包;2、从玩家当前钱包中取出1枚硬币(注意不能为0)。 A先走,并且当某位玩家无法做出有效举动时,另一 ......
codeforces hello 2024

CodeForces Hello 2024 个人题解(A~C)

A. Wallet Exchange 时间限制: 1秒 内存限制: 256兆 输入: 标准输入 输出: 标准输出 Alice and Bob are bored, so they decide to play a game with their wallets. Alice has a coins ......
题解 CodeForces Hello 个人 2024

[Codeforces] CF1553D Backspace

CF1553D Backspace 说实话这题不配绿题 题目传送门 题面 给你两个字符串 \(S,T\) ,问你能否通过将 \(S\) 中的若干个数换成 Backspace 来使其变成 \(T\) 。Backspace 能删去前一个输入的字符。 思路 很明显,如果将一个字符换成Backspace,那 ......
Codeforces Backspace 1553D 1553 CF

[Codeforces] CF1551C Interesting Story

CF1551C Interesting Story 题目传送门 题意 给定 \(n\) 个仅由 \(\texttt{a,b,c,d,e}\) 组成的单词 (\(n \le 2\times 10^5\)),从其中选出尽可能多的单词,使得存在某个字母在这些单词中出现的次数比其他所有字母的出现次数之和还要 ......
Interesting Codeforces 1551C Story 1551

Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.

Launching lib/main.dart on 22011211C in debug mode... e: /Users/mm/.gradle/caches/transforms-3/37865fb99fa1fb60cf850910df4bb8bf/transformed/jetified-k ......

查看mvn版本:cannot execute binary file

一、现象 二、原因 网络资料上大部分的原因是因为jdk不是46位导致失败。其实我这边的原因也查不多,目前使用的是Mac M2芯片的电脑但是还安装之前的jdk版本,将其替换为macos arm版本即可。 三、操作 JDK下载官网下载、解压并更新环境变量 四、修复 ......
execute 版本 cannot binary file

Codeforces Round 917 (Div. 2)

Codeforces Round 917 (Div. 2) 康复训练 A. Least Product #include <bits/stdc++.h> #define endl '\n' using namespace std; int n; void solve(){ cin >> n; int ......
Codeforces Round 917 Div

Codeforces Round 918 (Div. 4)

D. Unnatural Language Processing 给字符串元素按要求间隔”.“ #include<bits/stdc++.h> using namespace std; void solve(){ int n; string s; cin>>n>>s; string o=s; for ......
Codeforces Round 918 Div

Codeforces Round 917 (Div. 2)

A. Least Product 求乘积最小,可以改数组元素 #include<bits/stdc++.h> #define int long long using namespace std; void solve(){ int n; cin>>n; int ans=1; for(int i=1; ......
Codeforces Round 917 Div

145. Binary Tree Postorder Traversal

public List<Integer> postorderTraversal(TreeNode root) { List<Integer> list = new ArrayList<>(); if (root == null) return list; Stack<TreeNode> stack ......
Postorder Traversal Binary Tree 145

144. Binary Tree Preorder Traversal

Solution 1://非递归 public List<Integer> preorderTraversal(TreeNode root) { List<Integer> result = new ArrayList<>(); if (root == null) { return result; ......
Traversal Preorder Binary Tree 144

Codeforces 1852D Miriany and Matchstick

首先考虑到第一行是固定的,先去掉第一行的贡献。 接下来会有一个 \(O(n^2)\) 的 \(\text{DP}\)。 考虑设 \(f_{i, 0 / 1, j}\) 为考虑了 \(1\sim i\) 列的放置,第 \(i\) 列填 \(\text{A / B}\) 且对数为 \(j\) 是否可行。 ......
Codeforces Matchstick Miriany 1852D 1852

Educational Codeforces Round 160 (Rated for Div. 2)

A 直接模拟,注意细节 #include<bits/stdc++.h> #define ll long long using namespace std; ll p[15] = {1}; void solve() { ll x; cin >> x; int len = 0; while(x / p[ ......
Educational Codeforces Round Rated 160
共1506篇  :1/51页 首页上一页1下一页尾页