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 ...
随机推荐
- python web框架 推荐
Flask 很轻,花很少的成本就能够开发一个简单的网站.非常适合初学者学习. 学会以后,可以考虑学习插件的使用,用 SQLAlchemy + Flask-SQLAlchemy 来对你的数据库进行控制. ...
- $.messager.show扩展:指定位置显示
扩展了个$.messager.showBySite,根据舍得的位置显示$.messager.show.代码如下: /** * 指定位置显示$.messager.show * options $.mes ...
- oracle+SQL优化实例
1. 减少I/O操作: SELECT COUNT(CASE WHEN empno>20 THEN 1 END) c1,COUNT(CASE WHEN empno<20 THEN 1 ...
- 第一百四十五节,JavaScript,同步动画
JavaScript,同步动画 将上一节的,移动透明动画,修改成可以支持同步动画,也就是可以给这个动画方法多个动画任务,让它同时完成 原理: 向方法里添加一个属性,这个属性是一个对象,同步动画属性,属 ...
- Torch-RNN运行过程中的坑 [2](Lua的string sub函数,读取中文失败,乱码?)
0.踩坑背景 仍然是torch-rnn/LanguageModel.lua文件中的一些问题,仍然是这个狗血的LM:encode_string函数: function LM:encode_string( ...
- django form POST方法提交表达
之前就着手开始尝试用django来简化web开发的流程周期,果不其然,速度还行,当然前期的产品那就相当粗糙了.举例来说,就连最基本的登录都是抄别人的,最可怕的是用GET方法提交表单,今天就尝试解决这个 ...
- EntityFramework增删改查
http://www.cnblogs.com/libingql/archive/2013/01/29/2881988.html
- IIS服务中五种身份验证的灵活运用
微软IIS服务是一项经典的Web服务,可以为广大用户提供信息发布和资源共享功能.身份认证是保证IIS服务安全的基础机制,IIS支持以下5种 Web 身份认证方法: 一.匿名身份认证 如果启用了匿名访问 ...
- knowledgeroot 的配置与优化
首先下载 KnowledgeRoot 的安装包,就是一个压缩文件,解压缩后放到 WebRoot 下面 在浏览器中打开网站,自动提示进行安装,安装的过程很简单,安装结束后即可以使用. 安装包创建的数据库 ...
- 【BZOJ2653】middle 二分+可持久化线段树
[BZOJ2653]middle Description 一个长度为n的序列a,设其排过序之后为b,其中位数定义为b[n/2],其中a,b从0开始标号,除法取下整.给你一个 长度为n的序列s.回答Q个 ...