C. Queen Codeforces Round #549 (Div. 2) dfs】的更多相关文章

C. Queen time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a rooted tree with vertices numerated from 11 to nn. A tree is a connected graph without cycles. A rooted tree has a s…
---恢复内容开始--- You are given a rooted tree with vertices numerated from 11 to nn . A tree is a connected graph without cycles. A rooted tree has a special vertex named root. Ancestors of the vertex ii are all vertices on the path from the root to the v…
Codeforces Round #549 (Div. 2) B. Nirvana [题目描述] B. Nirvana time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Kurt reaches nirvana when he finds the product of all the digits of some positive int…
今天试图用typora写题解 真开心 参考 你会发现有很多都是参考的..zblzbl Codeforces Round #549 (Div. 1) 最近脑子不行啦 需要cf来缓解一下 A. The Beatles 这道题就是枚举啦 有两种步长 试一下就好了 如果你的步长是x 那么要跳的次数就是距离除以步长 \[ \frac{n * k * x}{gcd(n * k, x)} \div x = \frac{n * k}{gcd(n * k, x)} \] #include <cmath> #in…
C. Queen time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a rooted tree with vertices numerated from 11 to nn. A tree is a connected graph without cycles. A rooted tree has a s…
---恢复内容开始--- Kurt reaches nirvana when he finds the product of all the digits of some positive integer. Greater value of the product makes the nirvana deeper. Help Kurt find the maximum possible product of digits among all integers from 1 to n. Input…
The Doors +0 找出输入的01数列里,0或者1先出完的的下标. Nirvana +3 输入n,求1到n的数字,哪个数逐位相乘的积最大,输出最大积. 思路是按位比较,从低到高,依次把小位换成全9,判断一下.细节上容易出错,比如边界和减一的情况.要多加小心. Queen +0 给一棵树,删除树中一些点,这些点的\(C_i\)权值是1,且直接的孩子也也是1.从小到大依次输出删除的编号. 中间我以为是所有子孙的权值都要是1,幸好发现了. The Beatles /+0 给一个\(n \cdot…
传送门 A.The Doors 看懂题目就会写的题 给一个 $01$ 序列,找到最早的位置使得 $0$ 或 $1$ 已经全部出现 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> using namespace std; typedef long long ll; inline int read() { ,f=; ch…
A. The Doors 代码: #include <bits/stdc++.h> using namespace std; ; int N; , One = ; int a[maxn], b[maxn], suma[maxn], sumb[maxn]; int num1, num2, ans; int main() { scanf("%d", &N); ; i < N; i ++) { scanf("%d", &a[i]); )…
https://codeforces.com/contest/1143/problem/D D. The Beatles time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently a Golden Circle of Beetlovers was found in Byteland. It is a circle rou…