codeforces B. Color the Fence 解题报告】的更多相关文章

题目链接:http://codeforces.com/problemset/problem/349/B 题目意思:给定v升的颜料和9个需要花费ad 升的颜料,花费ad 升的颜料意味着得到第d个数字,现在要求在所有的花费不超过v升的情况下,使得这些数字组合起来是最大的. 一开始直接从最小花费的颜料着手,如果花费的颜料是相同的,就转到从d(也就是位数)最大贪心.这样测试9就开始卡住了. 受到乌冬兄的指点迷津,终于有了思路,陆陆续续改了很多次,终于过了.以下摘自他的语录,白话文,大家请谅解: 稳用颜料…
1.codeforces 349B    Color the Fence 2.链接:http://codeforces.com/problemset/problem/349/B 3.总结: 刷栅栏.1-9每个字母分别要ai升油漆,问最多可画多大的数字. 贪心,也有点考思维. #include<bits/stdc++.h> using namespace std; #define LL long long #define INF 0x3f3f3f3f int main() { ]; while(…
Codeforces Educational Round 92 赛后解题报告 惨 huayucaiji 惨 A. LCM Problem 赛前:A题嘛,总归简单的咯 赛后:A题这种**题居然想了20min 我说这句话,肯定是有原因的,我们看到 \(\operatorname{lcm}\) 会想到之前一些题:题目,我的题解 自然就往 \(a\times b=\operatorname{gcd}(a,b)\times \operatorname{lcm}(a,b)\) 的方向思考,但是,这太麻烦了,…
题目链接:http://codeforces.com/problemset/problem/476/C 题目意思:给出两个数:a 和 b,要求算出 (x/b) / (x%b) == k,其中 k 的取值范围是 [1, a],找出满足所有正整数的 x 并求出所有 x 的和. 是不是觉得无从下手呢?我当时也是 = =  .....看了整晚题解,算是看懂了... 首先设 d = x / b,   m = x % b,那么整条式子就变成 d/m = k  —> d = mk(1) (好快你就知道有啥用了…
题干 Bob is very interested in the data structure of a tree. A tree is a directed graph in which a special node is singled out, called the "root" of the tree, and there is a unique path from the root to each of the other nodes. Bob intends to colo…
CF一如既往在深夜举行,我也一如既往在周三上午的C++课上进行了virtual participation.这次div2的题目除了E题都水的一塌糊涂,参赛时的E题最后也没有几个参赛者AC,排名又成为了手速与精准的竞争--(遗憾,如果参加了一定可以上分的吧orz) A题: 先判断起点和终点的距离是否被每次跳的距离整除,如果不整除就到不了.再检验跳跃过程中的落点是否均合法即可. #include<stdio.h> #include<bits/stdc++.h> #include <…
349B - Color the Fence 贪心 代码: #include<iostream> #include<algorithm> #include<cstdio> #include<cmath> #include<cstring> using namespace std; ; const int INF=0x7f7f7f7f; ]; int main() { int n; int MIN=INF; ; cin>>n; ;i&l…
题目描述: D. Color the Fence time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to…
题目链接:http://codeforces.com/problemset/problem/363/B 题目意思:给定整数n和k,需要从n个数中找出连续的k个数之和最小,输出这连续的k个数中的第一个数的下标. 直接暴力果断TLE,于是想到之前做的那条332B - Maximum Absurdity DP题的做法,决定开多一个额外的数组b[],在输入的时候把a[i]中前i个数的和都记录到b[i]中,这样通过b[i] - b[i-k]即可得出序列h1, h2, ..., hn (1 ≤ hi ≤ 1…
作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 动态规划 日期 题目地址:https://leetcode-cn.com/problems/sum-of-digits-in-the-minimum-number/ 题目描述 There is a fence with n posts, each post can be painted with one of the k colors. You hav…