URAL 2078 Bowling game
题目:
Bowling game
- The game includes 10 frames (rounds), in each frame one can earn up to 30 points.
- In each frame, excluding the last one, the aim is to knock down 10 pins with two rolls. If all pins are knocked down with the first roll, the second roll is omitted.
- In the last frame one must initially knock down 10 pins with two rolls as well. If the player succeeds, (s)he gets an extra (third) roll. All available rolls must be used, that is, if all pins have been knocked down and there are rolls left, new 10 pins are put. These 10 pins, if knocked down, do not give extra rolls.
- Each knocked down pin gives one point.
- If a strike is made (all pins knocked down with one roll) in each frame excluding the last one, the player receives one extra point per each pin knocked down in two subsequent rolls when scoring that frame.
- If a spare is made (all pins knocked down with two rolls) in each frame excluding the last one, the player receives one extra point per each pin knocked down in one subsequent roll when scoring that frame.
Input
Output
Example
| input | output |
|---|---|
10 2 4 8 3 8 1 9 8 7 |
60 62 |
2 4 6 8 10 10 8 6 4 2 |
60 86 |
思路:被题意hack,总是少看了点东西。
求最小时均认为第二球得分,0 10 0 10的得分就可以避免分数加倍,
最大时认为第一球得分,如10 8 0 6 0
最后特判下第十个得分就可以了
#include <bits/stdc++.h> using namespace std; #define MP make_pair
#define PB push_back
typedef long long LL;
typedef pair<int,int> PII;
const double eps=1e-;
const double pi=acos(-1.0);
const int K=1e6+;
const int mod=1e9+; int n,v[],mx,mi; int main(void)
{
for(int i=;i<=;i++)
{
cin>>v[i];
if(i!=) mi+=v[i],mx+=v[i];
if(i!=&&i->&&v[i-]==&&v[i-]==) mx+=v[i];
if(i!=&&i->&&v[i-]==) mx+=v[i];
}
if(v[]<=)
{
mi+=v[],mx+=v[];
if(v[]==v[]&&v[]==)mx+=v[];
if(v[]==)mx+=v[];
}
else
{
if(v[]<=)
{
if(v[]==v[]&&v[]==)mx+=+(v[]-)*;
else if(v[]==) mx+=+(v[]-)*;
else mx+=v[];
}
else
{
if(v[]==v[]&&v[]==)mx+=+v[]-;
else if(v[]==) mx+=+v[]-;
else mx+=v[];
}
if(v[]==)
{
if(v[]<=)
mi+=v[];
else
mi+=+v[];
}
else
mi+=v[];
} cout<<mi<<" "<<mx<<endl;
return ;
}
URAL 2078 Bowling game的更多相关文章
- URAL 2078~2089
URAL 2078~2089 A - Bowling game 题目描述:给出保龄球每一局击倒的球数,按照保龄球的规则,算出总得分的最小值和最大值. solution 首先是最小值:每一局第一球击倒\ ...
- URAL 1775 B - Space Bowling 计算几何
B - Space BowlingTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...
- POJ 3176 Cow Bowling
Cow Bowling Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13016 Accepted: 8598 Desc ...
- 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
- ural 2073. Log Files
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...
- ural 2070. Interesting Numbers
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...
- ural 2069. Hard Rock
2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...
- ural 2068. Game of Nuts
2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in proces ...
随机推荐
- 第二百零五节,jQuery EasyUI,Messager(消息窗口)组件
jQuery EasyUI,Messager(消息窗口)组件 学习要点: 1.加载方式 2.属性列表 3.方法列表 本节课重点了解 EasyUI 中 Messager(消息窗口)组件的使用方法,这个组 ...
- 【vijos】1764 Dual Matrices(dp)
https://vijos.org/p/1764 自从心态好了很多后,做题的确很轻松. 这种题直接考虑我当前拿了一个,剩余空间最大能拿多少即可. 显然我们枚举每一个点拿出一个矩形(这个点作为右下角), ...
- 【Raspberry Pi】定时运行python程序读温湿度传感器数据&发邮件
1.定时执行脚本 http://tech.it168.com/a2011/0707/1214/000001214830_all.shtml /sbin/service crond start //启动 ...
- linux jdk 6 版本下载
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-41940 ...
- 用angular做的模糊搜索
今天大家来试一试用angular做一下简单的搜索功能吧: 首先我们需要写html的部分,我们需要设置几个条件,比如按什么来排序,按升序还是降序搜索,和一个文本框来设置模糊搜索: <nav> ...
- HDU 1232 畅通工程(Kruskal)
畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- 实践中需要了解的cpu特性
目录 分段机制 特权级检查 GDT和LDT 堆栈切换 分页机制 中断 分段机制 实模式中cs是一个实实在在的段首地址,ip为cs所指向段的偏移,所以cs<<4+ip是当前cpu执行的指令. ...
- python array
python中通常情况下for循环会枚举各个元素不会访问下标,例如: l = [1,2,4,6] for val in l: print l 但是有时候我们会需要在便利数组的同时访问下标,这时候可以借 ...
- 在.NET中读取嵌入和使用资源文件的方法
转http://www.jb51.net/article/84660.htm 本文分别介绍了使用GetManifestResourceStream读取嵌入资源,和使用. resx资源文件嵌入资源,希望 ...
- 转!!SQL左右连接中的on and和on where的区别
原博文地址:http://blog.csdn.net/xingzhemoluo/article/details/39677891 原先一直对SQL左右连接中的on and和on where的区别不是太 ...