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 ...
随机推荐
- 用Eclipse的tomcat插件启动tomcat时报错:
用Eclipse的tomcat插件启动tomcat时报错: FATAL ERROR in native method: JDWP No transports initialized, jvmtiErr ...
- nested exception is java.lang.VerifyError: Expecting a stackmap frame at bra
Caused by: java.lang.VerifyError: Expecting a stackmap frame (2016-05-19 09:56:29) 转载▼ 标签: it 分类: Ja ...
- WCF系列 基础概念
WCF全称Windows Communication Foundation,是微软构建面向服务的分布式编程框架.而它其实是统一了COM和.Net Remoting等分布式技术提供一个完整,通用,可靠的 ...
- 第二百三十三节,Bootstrap表格和按钮
Bootstrap表格和按钮 学习要点: 1.表格 2.按钮 本节课我们主要学习一下 Bootstrap 表格和按钮功能,通过内置的 CSS 定义,显示各 种丰富的效果. 一.表格 Bootstrap ...
- Log4J是Apache组织的开源一个开源项目,通过Log4J,可以指定日志信息输出的目的地,如console、file等。Log4J采用日志级别机制,请按照输出级别由低到高的顺序写出日志输出级别。
Log4J是Apache组织的开源一个开源项目,通过Log4J,可以指定日志信息输出的目的地,如console.file等.Log4J采用日志级别机制,请按照输出级别由低到高的顺序写出日志输出级别. ...
- 设置EntityFramework中decimal类型数据精度
EF中默认的decimal数据精度为两位数,当我们数据库设置的精度大于2时,EF将只会保留到2为精度. e.g. 2.1999将会被保存为2.20 网上找到常见的方法为重写DbContext的OnMo ...
- 嵌入式驱动开发之spi---spi串口通信调试
一. 概念 SPI是 Serial Peripheral Interface(串型外部接口)的缩写.SPI接口有4根PIN脚,分别是: * SPICLK : 用于传输数据的同 ...
- ubuntu安装scala详细教程
ubuntu14 安装scala详细教程 1.下载scala压缩包 http://www.scala-lang.org/download/ 2.建立目录,解压文件到所建立目录 $ sudo mkdir ...
- 探讨instanceof实现原理,并用两种方法模拟实现 instanceof
在开始之前先了解下js数据类型 js基本数据类型: null undefined number boolean string js引用数据类型: function object array 一说ins ...
- java jdk 1.6 下载
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-41940 ...