Quasi Binary time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A number is called quasibinary if its decimal representation contains only digits 0 or 1. For example, numbers 0, 1, 101, 11001…
D. Merge Equals time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array of positive integers. While there are at least two equal elements, we will perform the following oper…
题目链接:http://codeforces.com/contest/598/problem/E E. Chocolate Bar time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have a rectangular chocolate bar consisting of n × m single squares. Y…
蒟蒻就切了四道水题,然后EF看着可写然而并不会,中间还WA了一次,我太菜了.jpg =.= A.Vasya And Password 一开始看着有点虚没敢立刻写,后来写完第二题发现可以暴力讨论,因为保证有解,没了 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ; char rd[N]; int main () { int T; scanf("%d"…
D. Longest Subsequence 题目连接: http://www.codeforces.com/contest/632/problem/D Description You are given array a with n elements and the number m. Consider some subsequence of a and the value of least common multiple (LCM) of its elements. Denote LCM a…
A:Vasya And Password 代码: #include<bits/stdc++.h> using namespace std; #define Fopen freopen("_in.txt","r",stdin); freopen("_out.txt","w",stdout); #define LL long long #define ULL unsigned LL #define fi first #…
F - The Shortest Statement emmm, 比赛的时候没有想到如何利用非树边. 其实感觉很简单.. 对于一个询问答案分为两部分求: 第一部分:只经过树边,用倍增就能求出来啦. 第二部分:经过至少一条非树边, 如果经过一个树边那么必定经过其两个端点,暴力的求出这些端点为起始点的最短路. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make…
模拟题,运用强大的stl. #include <iostream> #include <map> #include <algorithm> #include <set> #define N 150005 using namespace std; typedef long long Int; ; map<long long, set<int> > mapp; long long a[N]; int main() { int n; cin…
前缀后缀和搞一搞,然后枚举一下区间,找出最大值 #include <iostream> #include <algorithm> using namespace std; ; int a[maxn], f[maxn], b[maxn], c[maxn]; int main() { ios::sync_with_stdio(false); int n, k; cin >> n >> k; ; i <= n; i++) cin >> a[i];…
题目 Source http://codeforces.com/contest/467/problem/C Description The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced t…