18CCPC网赛A 贪心】的更多相关文章

Buy and Resell Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2023    Accepted Submission(s): 738 Problem Description The Power Cube is used as a stash of Exotic Power. There are n cities numbe…
option=com_onlinejudge&Itemid=8&page=show_problem&category=648&problem=5158&mosmsg=Submission+received+with+ID+1708713">https://icpcarchive.ecs.baylor.edu/index.php? option=com_onlinejudge&Itemid=8&page=show_problem&…
Description There is a special number sequence which has n+1 integers. For each number in sequence, we have two rules: ● a i ∈ [0,n] ● a i ≠ a j( i ≠ j ) For sequence a and sequence b, the integrating degree t is defined as follows(“�” denotes exclus…
http://acm.hdu.edu.cn/showproblem.php?pid=6705 这是比赛前8题过的人数第二少的题,于是就来补了,但感觉并不难啊..(怕不是签到难度 题意:给个图,给几条路,让你求第k短路,所有路径不限制使用次数. 思路:最短路肯定是最短的那条,第2短就有2种可能,可能是长度第二短的那条,也有可能是接着刚才的最短路继续走(2个还不会,但是先这样拓展),到第3短就真的是2种可能了(例如1,2,9,1+2<9),但是k短路显然最多是由k段拼成(反证法:如果是k+1条,那个…
贪心策略 1.使负数为偶数个,然后负数就不用管了 2.0变为1 3.1变为2 4.2变为3 5.若此时操作数剩1,则3+1,否则填个1+1,然后回到5…
以为是贪心,结果不是,2333 贪心最后对自己绝对有利的情况 点我 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> #include<map> using namespace std; #define MOD 1000000007 const int INF=0…
B-Coin Bob has a not even coin, every time he tosses the coin, the probability that the coin's front face up is \frac{q}{p}(\frac{q}{p} \le \frac{1}{2})​p​​q​​(​p​​q​​≤​2​​1​​). The question is, when Bob tosses the coin kktimes, what's the probabilit…
题意 等价于给一个数列,每次对一个长度为$K$的连续区间减一 为最多操作多少次 题解: 看样例猜的贪心,10分钟敲了个线段树就交了... 从1开始,找$[i,i+K]$区间的最小值,然后区间减去最小值,答案加上最小值即可... 这个思路,后来我看博客上的总结,应该是没问题的, 可是,依旧不知道线段树写的对不对..因为是假数据... #include <bits/stdc++.h> #define ll long long #define IO ios::sync_with_stdio(fals…
题目链接 :https://nanti.jisuanke.com/t/26217 Description: There is a positive integer X, X's reversion count is Y. For example, X=123, Y=321; X=1234, Y=4321. Z=(X-Y)/9, Judge if Z is made up of only one number(0,1,2...9), like Z=11,Z=111,Z=222,don't cons…
开始还觉得是贪心呢... 给你三类积木叫你叠楼房,给你的每个积木包括四个值:长 宽(可以互换) 高 类型d d=0:你只能把它放在地上或者放在 长 宽 小于等于 自己的积木上面 d=1:你只能把它放在地上或者放在 长 宽 小于等于 自己的积木上面,但是这儿其面积必须大于下面积木的面积 d=2:你只能把它放在地上或者放在 长 宽 小于 自己的积木上面 最后给你n块积木,问你最高可以堆多高 如果直接遍历的话每块积木都可以放在任意位置(满足条件),无法使用dp.但是注意这儿有个条件就是当d变大时,堆积…