Dice chrone execise
def score(dices_input):
count = {}.fromkeys(range(1, 7), 0)
points = 0
for dice_side in dices_input:
count[dice_side] += 1
# print count
points = (count[1]/3)*1000 + (count[1]%3)*100 + (count[5]%3)*50
for i in range(2, 7):
points += (count[i]/3) * i * 100 return points if __name__=="__main__":
print "The score of the given examples:"
print "score[1,1,1,5,1]=%d" %score([1,1,1,5,1])
print "score[2,3,4,6,2]=%d" %score([2,3,4,6,2])
print "score[3,4,5,3,3]=%d" %score([3,4,5,3,3])
print "score[1,5,1,2,4]=%d" %score([1,5,1,2,4])
print "You can try others"
a=raw_input("Input five numbers:")
input_s=[0,0,0,0,0]
if len(a.split())!=0:
b=a.split()
for i in range(len(input_s)):
input_s[i]=int(b[i])
print score(input_s)
Dice chrone execise的更多相关文章
- HDOJ 4652 Dice
期望DP +数学推导 Dice Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...
- 三种renderman规范引擎的dice对比
次表面做的有些烦躁,既然如此,索性先记一下前一阵比较的PIXIE.3delight.prman的dice方式. 研究过reyes的人都知道dice,简而言之,就是为了生成高质量高精度的图片(电影CG) ...
- LightOJ 1248 Dice (III) 概率
Description Given a dice with n sides, you have to find the expected number of times you have to thr ...
- hdu 4586 Play the Dice 概率推导题
A - Play the DiceTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...
- 概率 Gym 100502D Dice Game
题目传送门 /* 题意:两个人各掷两个骰子,给出每个骰子的最小值和最大值,其余值连续分布 问两人投掷,胜利的概率谁大 数据小,用4个for 把所有的可能性都枚举一遍,统计每一次是谁胜利 还有更简单的做 ...
- HDU 5955 Guessing the Dice Roll
HDU 5955 Guessing the Dice Roll 2016 ACM/ICPC 亚洲区沈阳站 题意 有\(N\le 10\)个人,每个猜一个长度为\(L \le 10\)的由\(1-6\) ...
- UVALive 7275 Dice Cup (水题)
Dice Cup 题目链接: http://acm.hust.edu.cn/vjudge/contest/127406#problem/D Description In many table-top ...
- HDU 4586 A - Play the Dice 找规律
A - Play the DiceTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...
- CF Polycarpus' Dice (数学)
Polycarpus' Dice time limit per test 1 second memory limit per test 256 megabytes input standard inp ...
随机推荐
- viewport使用 html5
viewport 语法介绍: 01 02 width 控制 viewport 的大小,可以指定的一个值或者特殊的值,如 device-width 为设备的宽度(单位为缩放为 100% 时的 CSS 的 ...
- lua编程基础
1.目前最新的lua版本是lua5.2.3 2.官网下载地址:http://www.lua.org/ftp/ 3.lua的初衷就是一个用于c/c++的小巧的脚本语言,本身是什么功能都没有的,需要手动用 ...
- LintCode-Serialization and Deserialization Of Binary Tree
Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a ...
- JavaScript 变量、作用域和内存问题
JavaScript的基本类型值和引用类型值具有以下特点: 1.基本类型值在内存中占据固定的大小,因此被保存在栈内存中: 2.引用类型值是对象,保存在堆内存中: 3.从变量向另一个变量复制基本类型的值 ...
- OS X 使用技巧——在Finder窗口标题栏上显示路径
Finder窗口默认显示当前文件夹的名称或当前所在的模式(例如AirDrop).如果想要显示路径(用User/[当前用户账号名称]/Documents 替代以前显示的Documents),打开终端并运 ...
- 使用IntersectionObserver更高效的监视某个页面元素是否进入了可见窗口
比如说,你想跟踪 DOM 树里的一个元素,当它进入可见窗口时得到通知. 也许想实现即时延迟加载图片功能,或者你需要知道用户是否真的在看一个广告 banner. 你可以通过绑定 scroll 事件或者用 ...
- 【BZOJ】【3522】【POI2014】Hotel
暴力/树形DP 要求在树上找出等距三点,求方案数,那么用类似Free Tour2那样的合并方法,可以写出: f[i][j]表示以 i 为根的子树中,距离 i 为 j 的点有多少个: g[i][j]表示 ...
- NYOJ-58 最小步数 AC 分类: NYOJ 2014-01-22 22:01 217人阅读 评论(0) 收藏
#include<stdio.h> void dfs(int step,int x,int y); int d[4][2] = {{1,0},{-1,0},{0,1},{0,-1}}; i ...
- DSP中的cmd文件
一.CMD文件 链接命令文件(Link Command Files),以后缀.cmd结尾,简称CMD文件. CMD文件的两大功能是指示存储空间和分配段到存储空间. 在编写CMD文件时,主要采用MEMO ...
- HDOJ 2069 Coin Change(母函数)
Coin Change Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...