C. Vasya and Golden Ticket time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Recently Vasya found a golden ticket - a sequence which consists of n digits a1a2-an. Vasya considers a ticket to be l…
任意门:http://codeforces.com/contest/1058/problem/C C. Vasya and Golden Ticket time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Vasya found a golden ticket — a sequence which consists…
#点击传送 题目描述 Recently Vasya found a golden ticket - a sequence which consists of nn digits a1a2-ana1a2-an. Vasya considers a ticket to be lucky if it can be divided into two or more non-intersecting segments with equal sums. For example, ticket 3501783…
链接: https://codeforces.com/contest/1215/problem/D 题意: Monocarp and Bicarp live in Berland, where every bus ticket consists of n digits (n is an even number). During the evening walk Monocarp and Bicarp found a ticket where some of the digits have bee…
题目链接: C. Vasya and String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output High school student Vasya got a string of length n as a birthday present. This string consists of letters 'a' and '…
E - Vasya and Binary String 思路:区间dp + 记忆化搜索 转移方程看上一篇博客. 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define y1 y11 #define pi acos(-1.0)…
E - Vasya and a Tree 思路: dfs动态维护关于深度树状数组 返回时将当前节点的所有操作删除就能保证每次访问这个节点时只进行过根节点到当前节点这条路径上的操作 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #include<bits/stdc++.h> using namespace std; #define fi first #define se second #de…
E. Vasya and Good Sequences time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya has a sequence $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$. Vasya may pefrom the fol…
A. Vasya and Book time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya is reading a e-book. The file of the book consists of nn pages, numbered from 11 to nn. The screen is currently disp…
Discription Vasya is studying number theory. He has denoted a function f(a, b) such that: f(a, 0) = 0; f(a, b) = 1 + f(a, b - gcd(a, b)), where gcd(a, b) is the greatest common divisor of a and b. Vasya has two numbers x and y, and he wants to calcul…
D. Vasya and Triangle time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Vasya has got three integers n, m and k. He'd like to find three integer points (x1,y1), (x2,y2), (x3,y3), such that 0≤x1,x…
C. Vasya and Robot time limit per test: 1 secondmemory limit per test: 256 megabytesinput: standard inputoutput: standard output Vasya has got a robot which is situated on an infinite Cartesian plane, initially in the cell (0,0)(0,0)(0,0). Robot can…
链接 某个数x属于[1,n],至少询问哪些数“x是否是它的倍数”才能判断x.找出所有质因数和质因数的幂即可. #include<cstdio> #include<algorithm> #define N 1005 using namespace std; int n,pr[N],ans[N],cnt; int main(){ scanf("%d",&n); for(int i=2;i<=n;i++) if(!pr[i]) for(int j=i*2…
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 枚举三分线(离散后)的位置 然后根据预处理的前缀和,快速算出两个队伍的分数. [代码] #include <bits/stdc++.h> using namespace std; const int N = 2e5; int n,m; int a[N+10],b[N+10],aa[2*N+100],bb[2*N+100]; map<int,int> dic; map<int,int> dic2; int main…