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的更多相关文章

  1. HDOJ 4652 Dice

      期望DP +数学推导 Dice Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others ...

  2. 三种renderman规范引擎的dice对比

    次表面做的有些烦躁,既然如此,索性先记一下前一阵比较的PIXIE.3delight.prman的dice方式. 研究过reyes的人都知道dice,简而言之,就是为了生成高质量高精度的图片(电影CG) ...

  3. LightOJ 1248 Dice (III) 概率

    Description Given a dice with n sides, you have to find the expected number of times you have to thr ...

  4. hdu 4586 Play the Dice 概率推导题

    A - Play the DiceTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...

  5. 概率 Gym 100502D Dice Game

    题目传送门 /* 题意:两个人各掷两个骰子,给出每个骰子的最小值和最大值,其余值连续分布 问两人投掷,胜利的概率谁大 数据小,用4个for 把所有的可能性都枚举一遍,统计每一次是谁胜利 还有更简单的做 ...

  6. HDU 5955 Guessing the Dice Roll

    HDU 5955 Guessing the Dice Roll 2016 ACM/ICPC 亚洲区沈阳站 题意 有\(N\le 10\)个人,每个猜一个长度为\(L \le 10\)的由\(1-6\) ...

  7. UVALive 7275 Dice Cup (水题)

    Dice Cup 题目链接: http://acm.hust.edu.cn/vjudge/contest/127406#problem/D Description In many table-top ...

  8. HDU 4586 A - Play the Dice 找规律

    A - Play the DiceTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...

  9. CF Polycarpus' Dice (数学)

    Polycarpus' Dice time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

随机推荐

  1. asp.net mvc 错误路由默认配置

    问题描述:默认情况下mvc已经将路由参数设置配置好了,这里就不在讲解,请到园子搜索,有很多这方面相关的文章.这里讲述的是,一个MVC项目中,我们输入一个错误的URL,或者根本不存在的URL,如:htt ...

  2. vhdl基础---分频

    偶数分频 ibrary IEEE; use IEEE.STD_LOGIC_1164.ALL; use ieee.std_logic_arith; use ieee.std_logic_unsigned ...

  3. JNI文件中命名类与JAVA文件中匹配

    jni.c中注册中 int register_android_boa(JNIEnv *env){    jclass clazz;    static const char* const kClass ...

  4. mysql 5.7 64位 解压版安装

    64位操作系统最好安装64位的mysql数据库,充分利用内存的寻址能力,对于windows而言,mysql官网只提供了32位的MSI安装程序,因为在windows下安装64位的mysql,选择解压版安 ...

  5. Django RequestContext用法

    模版中的变量由context中的值来替换,如果在多个页面模版中含有相同的变量,比如:每个页面都需要{{user}},笨办法就是在每个页面的请求视图中都把user放到context中.   from d ...

  6. python-面向对象(股票对象举例)

    股票对象实例 class Stock(object): def __init__(self,stockCode ,stockName,averagePrice_yesterday,averagePri ...

  7. Json Serialize 忽略特定属性

    Json Serialize 忽略特定属性 Json Serialize SerializeFilter 忽略特定属性 key words:Json Serialize jackson fastjso ...

  8. CSS Hack大全-可区分出IE6-IE10、FireFox、Chrome、Opera

    今天把一些常用的CSS Hack整理了一下,包括常用的IE hack以及火狐.Chrome.Opera浏览器的Hack,并把这些CSS Hack综合的一起,写了一个小的浏览器测试器.如图所示: 下面就 ...

  9. Apache CXF实现Web Service(4)——Tomcat容器和Spring实现JAX-RS(RESTful) web service

    准备 我们仍然使用 Apache CXF实现Web Service(2)——不借助重量级Web容器和Spring实现一个纯的JAX-RS(RESTful) web service 中的代码作为基础,并 ...

  10. PE文件结构

    PE头 typedef struct _IMAGE_NT_HEADERS { DWORD Signature; PE头标识 为固定的ascii码 PE\\ IMAGE_FILE_HEADER File ...