D. Round Subset time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to cho…
B. Flag of Berland time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The flag of Berland is such rectangular field n × m that satisfies following conditions: Flag consists of three colors whi…
C. Two Seals time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One very important person has a piece of paper in the form of a rectangle a × b. Also, he has n seals. Each seal leaves an impre…
/* CodeForces 837D - Round Subset [ DP ] | Educational Codeforces Round 26 题意: 选k个数相乘让末尾0最多 分析: 第i个数字有a[i]个2, b[i] 个5 以其中一维作体积另一维作价值01背包即可 */ #include <bits/stdc++.h> using namespace std; int dp[205][20005]; int get2(long long x) { int s = 0; while…
Educational Codeforces Round 26 困到不行的场,等着中午显示器到了就可以美滋滋了 A. Text Volume time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a text of single-space separated words, consisting of sm…
按tutorial打的我血崩,死活挂第四组- - 思路来自FXXL /* CodeForces 837F - Prefix Sums [ 二分,组合数 ] | Educational Codeforces Round 26 题意: 设定数组 y = f(x) 使得 y[i] = sum(x[j]) (0 <= j < i) 求初始数组 A0 经过多少次 f(x) 后 会有一个元素 大于 k 分析: 考虑 A0 = {1, 0, 0, 0} A1 = {1, 1, 1, 1} -> {C(…
/* CodeForces - 837E - Vasya's Function [ 数论 ] | Educational Codeforces Round 26 题意: f(a, 0) = 0; f(a, b) = 1 + f(a, b-gcd(a, b)); 求 f(a, b) , a,b <= 1e12 分析: b 每次减 gcd(a, b) 等价于 b/gcd(a,b) 每次减 1 减到什么时候呢,就是 b/gcd(a,b)-k 后 不与 a 互质 可先将 a 质因数分解,b能除就除,不能…
PROBLEM D - Round Subset 题 OvO http://codeforces.com/contest/837/problem/D 837D 解 DP, dp[i][j]代表已经选择了i个元素,当2的个数为j的时候5的个数的最大值 得注意最大值(貌似因为这个喵呜了一大片喵~☆) #include <iostream> #include <cstring> #include <cstdio> #include <cmath> #include…
给你n个数,让你任选K个,使得它们乘起来以后结尾的0最多. 将每个数的因子2和因子5的数量求出来,记作a[i]和b[i]. 答案就是max{ min{Σa[i],Σb[i]} }(a[i],b[i]是选择的那些数). 暴力dp是f(i,j,k)表示前i个数,选j个,其中包含k个5的情况下,最多能包含多少个2. 转移是f(i,j,k)=max{ {f(t,j-1,k-b[i]}+a[i]}(1<=i<t) , f(i-1,j,k) },时间是O(18 * n^3),但空间存不下. 注意第二维为j…
D. Round Subset time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Let's call the roundness of the number the number of zeros to which it ends. You have an array of n numbers. You need to cho…