[Codeforces-div.1 167B] Wizards and Huge Prize 试题分析 注意到每个物品互相独立,互不干扰之后就非常好做了. 算出一个物品最后的价值期望,然后乘以K即可. #include<iostream> #include<cstring> #include<cstdio> #include<vector> #include<algorithm> using namespace std; #define LL l…
B. Wizards and Huge Prize Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/167/problem/B Description One must train much to do well on wizardry contests. So, there are numerous wizardry schools and magic fees. One of such ma…
题意: n个人,开始有一个容量为k得背包,击败一个人背包可以获得一定容量或得到一个财富(放入背包内),给出击败每个人的概率,求至少击败l个人,且背包容量大于获得的总财富值的概率 分析: 状态好确定,dp[i][j][k]表示前i个人击败j个背包容量是k是的概率,求概率正推,要注意这时背包容量能为负,我们把容量都加上B. #include <map> #include <set> #include <list> #include <cmath> #includ…
初步分析:把赢了的巡回赛的a值加起来就是最后的剩余空间 这个明显的是状态转移的dp啊,然而他的状态比较骚是个数组,表示剩余空间,f(i,j,b),i表示比到第几场,j表示赢了几场,b就是里面的核心状态,总起来就是在比到第i场赢了j场时背包剩余空间b的概率,所以他们加起来一定是1,状态转移的话可以看做是在f(i,j,b)这个状态再比一场,输了转移到f(i+1,j,b),赢了转移到f(i+1,j+1,b+a[i+1])....一定要注意边界处理和初始化 #include<iostream> #in…
B. Wizards and Huge Prize time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output:standard output One must train much to do well on wizardry contests. So, there are numerous wizardry schools and magic fees. On…
A. Wizards and Trolleybuses Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/167/problem/A Description In some country live wizards. They love to ride trolleybuses. A city in this country has a trolleybus depot with n trolle…
A. Wizards' Duel Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/problem/A Description Harry Potter and He-Who-Must-Not-Be-Named engaged in a fight to the death once again. This time they are located at opposite ends of…
D. Wizards and Roads 题目连接: http://www.codeforces.com/contest/167/problem/D Description In some country live wizards. They love to build cities and roads. The country used to have k cities, the j-th city (1 ≤ j ≤ k) was located at a point (xj, yj). It…
E. Wizards and Bets 题目连接: http://www.codeforces.com/contest/167/problem/E Description In some country live wizards. They like to make weird bets. Two wizards draw an acyclic directed graph with n vertices and m edges (the graph's vertices are numbere…
C. Wizards and Numbers 题目连接: http://codeforces.com/problemset/problem/167/C Description In some country live wizards. They love playing with numbers. The blackboard has two numbers written on it - a and b. The order of the numbers is not important. L…
A. Efim and Strange Grade time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any po…
题目例如以下: B. The Child and Set time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output At the children's day, the child came to Picks's house, and messed his house up. Picks was angry at him. A lot o…
Codeforces Round #114 (Div. 2) 代码 Codeforces Round #114 (Div. 2) C. Wizards and Trolleybuses 思路 每条车的到达时间不会小于前一辆车,计算两者时间取最大值. D. Wizards and Huge Prize 思路 \(f(i, j, k)\)表示前\(i\)场比赛赢\(j\)场袋子与奖牌的差值为\(k\)的概率. E. Wizards and Numbers 假设\(a \le b\),那么最后会进入状…
前面说点什么.. 为了完成日常积累,傻逼呵呵的我决定来一发codeforces 挑水题 泛做.. 嗯对,就是泛做.. 主要就是把codeforces Div.1的ABCD都尝试一下吧0.0.. 挖坑0.0.. Codeforces Round #360 A. NP-Hard Problem 就是一个二分图染色,判断是否为二分图而已.. B. Remainders Game 题意:有一个未知的\(x\)和已知\(x\ mod\ c_i\)的值,问是否能确定\(x\ mod\ k\)的值 考虑一下中…
Problem 遗产 题目大意 给出一个带权有向图,有三种操作: 1.u->v添加一条权值为w的边 2.区间[l,r]->v添加权值为w的边 3.v->区间[l,r]添加权值为w的边 求st点到每个点的最短路 Solution 首先我们思考到,若是每次对于l,r区间内的每一个点都执行一次加边操作,不仅耗时还耗空间. 那么我们要想到一个办法去优化它.一看到lr区间,我们就会想到线段树对吧. 没错啦这题就是用线段树去优化它. 首先我们建一棵线段树,然后很容易想到,我们只需要把这一棵线段树当做…
大家好!先上图看看本次案例的整体效果. 实现思路: Vue component实现大转盘组件,可以嵌套到任意要使用的页面. css3 transform控制大转盘抽奖过程的动画效果. 抽奖组件内使用钩子函数watch监听抽奖结果的返回情况播放大转盘动画并给用户弹出中奖提示. 中奖结果弹窗,为抽奖组件服务. 实现步骤如下: 构建api奖品配置信息和抽奖接口,vuex全局存放奖品配置和中奖结果数据信息.api: export default { getPrizeList () { let prize…
大家好!先上图看看本次案例的整体效果. 完整版实战课程附源码:[Vue.js游戏机实战]- Vue.js实现九宫格水果机抽奖 实现思路: Vue component实现九宫格水果机组件,可以嵌套到任意要使用的页面. css3 transform控制九宫格水果机抽奖过程的动画效果. 抽奖组件内使用钩子函数watch监听抽奖结果的返回情况播放九宫格水果机动画并给用户弹出中奖提示. 中奖结果弹窗,为抽奖组件服务. 实现步骤如下: 构建api奖品配置信息和抽奖接口,vuex全局存放奖品配置和中奖结果数据…
大家好!先上图看看本次案例的整体效果. 完整版实战课程附源码:[Vue.js游戏机实战]- Vue.js实现老虎-机抽奖 实现思路: Vue component实现老虎-机组件,可以嵌套到任意要使用的页面. css3 transform控制老虎-机抽奖过程的动画效果. 抽奖组件内使用钩子函数watch监听抽奖结果的返回情况播放老虎-机动画并给用户弹出中奖提示. 中奖结果弹窗,为抽奖组件服务. 实现步骤如下: 构建api奖品配置信息和抽奖接口,vuex全局存放奖品配置和中奖结果数据信息.api:…
Fuzhou Yan'an Middle School Online Judge 又一次上线啦! 真的是一波三折,主要功劳必须得属于精通网页编排.ubuntu 下如何使用 rm -rf 语句但是又能够坚持不跑路奋战到底的 Linhk1606 大佬,其实我在今天晚上都几乎对这个 Online Judge 绝望了准备重装了(因为数据表被 Linhk1606 使用了 rm -rf),把 Online Judge 的事丢给了 Linhk1606 大佬,没想到 TA 真的修好了!(但是原有数据没了),TA…
http://codeforces.com/contest/868/problem/D 优化:两个串合并 原有状态+ 第一个串的尾部&第二个串的头部的状态 串变为第一个串的头部&第二个串的尾部 注意: 头尾不能重复 如串A合并串A 这就意味着串的头尾不能有重合, 详见代码 #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <…
题意: 在一条长度为l的走廊,两个人站在走廊的左右两端分别以p,q的速度走来,问他们相遇时离左端的距离是多少? 思路: 非常简单的暴力题,不解释. 代码如下: #include <iostream> #include <cstdio> #include <cstring> #include <fstream> #include <ctime> #include <cmath> #include <cstdlib> #inc…
A. Remainder Codeforces Round #560 (Div. 3) You are given a huge decimal number consisting of nn digits. It is guaranteed that this number has no leading zeros. Each digit of this number is either 0 or 1. You may perform several (possibly zero) opera…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输出”#Color”,如果只有”G”,”B”,”W”就输出”#Black&White”. #include <cstdio> #include <cstring> using namespace std; const int maxn = 200; const int INF =…
 cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....       其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/output 1 s, 256 MB  x2377 B Queue standard input/output 2 s, 256 MB  x1250 C Hacking Cypher standard input/output 1 s, 256 MB  x740 D Chocolate standard in…
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his info…
Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Victor adores the sets theory. Let us remind you that a set is a group of…
A: 题目大意: 在一个multiset中要求支持3种操作: 1.增加一个数 2.删去一个数 3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给出的01序列相等(比较时如果长度不等各自用0补齐) 题解: 1.我的做法是用Trie数来存储,先将所有数用0补齐成长度为18位,然后就是Trie的操作了. 2.官方题解中更好的做法是,直接将每个数的十进制表示中的奇数改成1,偶数改成0,比如12345,然后把它看成二进制数10101,还原成十进制是2…