AtCoder Beginner Contest 163(D,E(区间dp),F(树上路径问题)),题目链接今天的题都很不错D-SumofLargeNumbers题意:求至少选k个数和的种类数。做法:刚开始感觉很难,涉及大数和、方案数。考虑k=2由于n+1个数是连续的,那我选最小的k个数求和:mi和最大的k个数求和:mx
code // Problem: D - Sum of SCC // Contest: AtCoder - AtCoder Regular Contest 163 // URL: https://atcoder.jp/contests/arc163/tasks/arc163_d // Memory Limit: 1024 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #include<bits/stdc++.h> #define...
AtCoder Beginner Contest 163E - Active Infants(DP) Problem Statement There are NN children standing in a line from left to right. The activeness of the ii-th child from the left is AiAi. You can rearrange these children just one time in any order you like. When a child who originally ...
AtCoder Beginner Contest 163 (6/6) 比赛链接:Here AB水题, C - management 题意:给一棵\(N(2\le N\le2e5)\) 个节点的有根树,求每个节点的儿子数。 思路:由于输入直接给的是每个节点的父节点,直接计数即可。 const int N = 2e5 + 10; int a[N]; int main() { ios::sync_with_stdio(...
AtCoder Beginner Contest 163 题目链接D: 看样例+分析得知,假设现在要选ii个,那么能达到的最大的值就是sumi1=∑nx=n−i+1xsumi1=∑x=n−i+1nx, 最小值就是sumi2=∑i−1x=0xsumi2=∑x=0i−1x,那么每次可选择的数量就是sum1−sum2+1sum1−sum2+1,那么答案就为∑n+1i=k(sumi1...
[AtCoder Beginner Contest 163] F path pass i (树型dfs,容斥定律) 链接:https://atcoder.jp/contests/abc163/tasks/abc163_f Problem Statement We have a tree with N
1. AtCoder Beginner Contest 163(5) 2. AtCoder Beginner Contest 167(4) 3. AtCoder Beginner Contest 164(3) 4. AtCoder Beginner Contest 156(3) 5. AtCoder Beginner Contest 160(2) 推荐排行榜 1. AtCoder Beginner Contest 162(3) 2. AtCoder Beginner Contest 168(2) 3. AtCoder...
思路:因为这里的数是连续的,所以 从n个数中选k个数出来的种类数 = k个最大的数 - k个最小的数 + 1 因为是做差,所以直接可以忽略那个10^100, 计算和的时候,因为是连续的,所以利用等差数列求和公式 列如样例1 最大的两个数-最小的两个数+1 = 5,选两个数时,所以有5种 ...
AtCoder Beginner Contest 163 比赛链接:https://atcoder.jp/contests/abc163/tasksA - Circle Pond题意由半径输出圆周长。代码#include <bits/stdc++.h> using namespace std; int main() { double r; cin >> r; cout << 2 * 3.14 * r; }B...
D - Sum of Large Numbers 题意:题目的大概意思就是存在N+1个数,分别为10100,10100+1,10100+2,10100+3...10100+N。从中至少选出K个数,求选出的K个数的和总共有多少种。 题解:这一题是一个很好的思维题,你看,选择K数,和选择K+