voiddfs(intnow, ll tmp_sum, ll sum){if(now == n +1) { res += sum + tmp_sum;return; }dfs(now +1, tmp_sum *10+ (s[now] -'0'), sum);dfs(now +1, (s[now] -'0'), sum + tmp_sum); }intmain(){ cin >> s; n = s.size(); s ='#'+ s;dfs(1,0,0); cout...
ARC061 C - たくさんの数式 / Many Formulas 这个其实105105也能做。。 就是dp[i]dp[i]表示到第i位的方案数,sum[i]sum[i]表示延伸到第i位之前的所有方案的数字的和,pre[i]pre[i]记录到第i位延伸已经结束了的数字的答案 转移是dp[i]=dp[i−1]∗2dp[i]=dp[i−1]∗2 sum[i]=sum[i...
for(int i = 1 ; i <= N ; ++i) { read(a[i]);read(b[i]); zz[mp(a[i],b[i])] = 1; } for(int i = 1 ; i <= N ; ++i) { for(int k = 0 ; k < 9 ; ++k) { int tx = a[i] + dx[k]; int ty = b[i] + dy[k]; if(tx > 1 && tx < H && ty >...
arc111 A - Simple Math 2 割り算 abc110 D - Factorization 二項係数, 素因数分解 arc004 D - 表現の自由 ( Freedom of expression ) 二項係数, 素因数分解 caddi2018 C - Product and GCD 素因数分解 arc110 D - Binomial Coefficient is Fun 二項係数 arc107 C - Shuffle Permutation Union Find ...
【AtCoder】ARC065 ARC065 C - 白昼夢 / Daydream 直接递推就好 D - 連結 / Connectivity 把图两次染色,然后标号,会得到一个点对,这个点对相同的点才在两个图里都连通 E - へんなコンパス / Manhattan Compass 曼哈顿转切比雪夫 然后把点对排序,每个点用横坐标相连就是 \(x_{a} - x_{b} = D...
parkQiita Advent Calendar is held! Qiita Advent Calendar is an article posting event where you post articles by filling a calendar 🎅 Some calendars come with gifts and some gifts are drawn from all calendars 👀 Please tie the article to your calendar and let's enjoy Christmas together!
【AtCoder】 ARC 102 linkC-Triangular Relationship发现要么全部是\(K\)的倍数,要么全部是模\(K\)余\(K/2,(K=2n)\)#include<bits/stdc++.h> #define ll long long #define dbg1(x) cerr<<#x<<"="<<(x)<<" " #define dbg2(x) cerr<<#x<<"="<<(x)<<"\n"...
ContestA ProblemB ProblemC Problem AGC038 A - 01 Matrix Python ARC Like ContestContestA ProblemB ProblemC ProblemD ProblemE ProblemF Problem DISCO presents ディスカバリーチャンネル コードコンテスト2020 予選 B - Iron Bar CuttingPython ABC Like Contest...
题目链接:https://atcoder.jp/contests/abc045/tasks/arc061_b 题目大意:有hw的网格初始都是白格,选n个将其染成黑色,求3x3的子网格包含黑色网格为0~9的个数。 题目思路:该题h,w范围较大故不能直接暴力求解。3x3的矩阵总和为(h-2)(w-2),对于一个黑色格可以影响的矩阵为9个,注意到n较小,所以我们最多...
128 more_horiz CancelDelete Comments No comments Let's comment your feelings that are more than good LoginSign Up Qiita Conference 2024 Autumn will be held!: 11/14(Thu) - 11/15(Fri) Qiita Conference is the largest tech conference in Qiita!