thumbnail
二进制与位运算
二进制 二进制([latex]Binary System[/latex])是一种以 [latex]2[/latex] 为基数的数制,只使用两个数字符号:[latex]0[/latex] 和 [latex]1[/latex], 每个数字称为一个比特([latex]Bit[/latex],[latex]Binary digit[/latex]…
thumbnail
动态规划题目详解
1.Vacations 链接:https://codeforces.com/problemset/problem/698/A 思路:     定义 [latex]dp[i][j][/latex] 为第 [latex]i[/latex] 天为 [latex]j[/latex] 时前 [latex]i[/late…
thumbnail
全区间函数值求和问题
摘要     “全区间函数值求和”是一个常见的算法模式:给定数组 [latex]a[1..n][/latex],我们要对所有子数组 [latex][L, R] (1 ≤ L ≤ R ≤ n)[/latex] 计算某个函数 [latex]f(L, R)[/latex] 的值,并把它们相加,求: [latex]\…
thumbnail
前缀和详解及其拓展
    前缀和(Prefix Sum) 是一个经典而高效的技巧,常用于快速查询数组区间和、处理计数类问题、解决某些离散数学性质问题。 一维前缀和     一维前缀和是指一个数组中从第一个元素开始,到当前位置的所有元素之和所构成的新数组。   &nbs…
thumbnail
算法模板
0 初始化 0.1 初始化1 /* __ __ ___ __ __ _ _ _ | \/ | |_ _| \ \ / / / \ | \ | | | |\/| | | | \ V / / _ \ | \| | | | | | | | | | / ___ \ | |\ | |_| |_| |___| |_| /_/ \_\ |_| \_| */ #i…
thumbnail
AtCoder Beginner Contest 393
链接:https://atcoder.jp/contests/abc393/tasks/abc393_a A - Poisonous Oyster 算法:     模拟。 思路:     无。 关键代码: void miyan() { string a, b; cin …
thumbnail
Codeforces Round 1056 (Div. 2)
链接:https://codeforces.com/contest/2155 A. El fucho 算法:     模拟。 思路:     打表。 关键代码: void miyan() { int n; cin >> n; cout << (n - 1) * 2 << endl; }…
thumbnail
AtCoder Beginner Contest 396
链接:https://atcoder.jp/contests/abc396 A - Triple Four 算法:     模拟。 思路:     无。 关键代码: void miyan() { int n; cin >> n; vector<int> a(n);…
thumbnail
AtCoder Beginner Contest 397
链接:https://atcoder.jp/contests/abc397 A - Thermometer 算法:     模拟。 思路:     无。 关键代码: void miyan() { double x; cin >> x; if (x < 37.5) cout << 3 <…
thumbnail
AtCoder Beginner Contest 429
链接:https://atcoder.jp/contests/abc429 A - Too Many Requests 算法:     模拟。 思路:     无。 关键代码: void miyan() { int n, m; cin >> n >> m; for (i…
thumbnail
AtCoder Beginner Contest 398
链接:https://atcoder.jp/contests/abc398 A - Doors in the Center 算法:     模拟。 思路:     无。 关键代码: void miyan() { int n; cin >> n; if (n …
thumbnail
AtCoder Beginner Contest 399
链接:https://atcoder.jp/contests/abc399 A - Hamming Distance 算法:     模拟。 思路:     无。 关键代码: void miyan() { int n; string s, t; cin >> n >> …
thumbnail
AtCoder Beginner Contest 400
链接:https://atcoder.jp/contests/abc400 A - ABC400 Party 算法:     模拟。 思路:     无。 关键代码: void miyan() { int n; cin >> n; if (400 % n) cout &…
thumbnail
AtCoder Beginner Contest 428
链接:https://atcoder.jp/contests/abc428 A - Grandma's Footsteps 算法:     模拟。 思路:     无。 关键代码: void miyan() { int s, a, b, x; cin >> s >> a…