题目:    

           Bowling game

In all asocial teams members ignore each other uniformly, each tight-knit team builds up team spirit their own way. Olya, Egor and Oleg, for example, go play bowling. This story is about how they once decided to take their coach Denis with them for the first time.
Denis is not used to close-knit teams and primitive fun, so he was not in favor of rolling balls. So when it came out that the device counting points near the lane was out of service, he willingly volunteered to perform the counting on a sheet of paper.
"What can be easier?", he thought, "One just needs to write down how many pins the player knocks down in each round. I can think out a couple of problems for the next training session simultaneously".
He has never been so wrong! At the end of the game it appeared that the scoring rules in bowling are not nearly just summing up knocked down pins, moreover, it came out that points cannot be restored from the number of knocked down pins. Oleg, Olya and Egor started to explain the rules of the game talking over each other: strikes, spares, extra roll in the last round... Denis nodded and thought: "Well, a decent problem we have here". He suggested the team calculating minimum and maximum points that can be scored by a player. It’s needless to say that Egor, Oleg and Olya completed this task easily. Now it’s your turn.
Here are the scoring rules in bowling.
  1. The game includes 10 frames (rounds), in each frame one can earn up to 30 points.
  2. 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.
  3. 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.
  4. Each knocked down pin gives one point.
  5. 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.
  6. 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

A single line contains 10 numbers separated by space — number of pins knocked down by the player in each of 10 frames. The first nine can take values from 0 to 10, the last one — from 0 to 30.

Output

Output minimum and maximum points a player could earn based on the game described in the input, separated by space.

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

  1. URAL 2078~2089

    URAL 2078~2089 A - Bowling game 题目描述:给出保龄球每一局击倒的球数,按照保龄球的规则,算出总得分的最小值和最大值. solution 首先是最小值:每一局第一球击倒\ ...

  2. URAL 1775 B - Space Bowling 计算几何

    B - Space BowlingTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...

  3. POJ 3176 Cow Bowling

    Cow Bowling Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13016   Accepted: 8598 Desc ...

  4. 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome

    题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...

  5. ural 2071. Juice Cocktails

    2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...

  6. ural 2073. Log Files

    2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...

  7. ural 2070. Interesting Numbers

    2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...

  8. ural 2069. Hard Rock

    2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...

  9. 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 ...

随机推荐

  1. 苹果mac版微软官方远程连接工具下载Microsoft Remote Desktop For Mac

    官网beta版本,不用再到处找包了. ** 点我访问https://rink.hockeyapp.net/apps/5e0c144289a51fca2d3bfa39ce7f2b06/**

  2. 第二百三十三节,Bootstrap表格和按钮

    Bootstrap表格和按钮 学习要点: 1.表格 2.按钮 本节课我们主要学习一下 Bootstrap 表格和按钮功能,通过内置的 CSS 定义,显示各 种丰富的效果. 一.表格 Bootstrap ...

  3. weblogic配置oracle数据源

    在weblogic配置oracle数据源还是挺简单的,网上也有很多关于这方面的文章,写给自己也写给能够得到帮助的人吧.weblogic新建域那些的就不说了哈.点击startWebLogic文件,会弹出 ...

  4. 设置select选中某个option

    <select class="selector"></select> 1.设置value为pxx的项选中 $(".selector"). ...

  5. 面试之Java持久层(十)

    91,什么是ORM?         对象关系映射(Object-Relational Mapping,简称ORM)是一种为了解决程序的面向对象模型与数据库的关系模型互不匹配问题的技术: 简单的说,O ...

  6. git 分回滚后无法合并代码问题

    git reset & git revert 区别: 1. git revert是用一次新的commit来回滚之前的commit,git reset是直接删除指定的commit. 2. 在回滚 ...

  7. server.xml文件详解

    一.server.xml文件介绍 1.server.xml作用     Server.xml配置文件用于对整个容器进行相关的配置. 2.server.xml文件的配置元素列表 <Server&g ...

  8. 160803、如何在ES6中管理类的私有数据

    如何在ES6中管理类的私有数据?本文为你介绍四种方法: 在类的构造函数作用域中处理私有数据成员 遵照命名约定(例如前置下划线)标记私有属性 将私有数据保存在WeakMap中 使用Symbol作为私有属 ...

  9. 如何设置,使IntelliJ IDEA智能提示忽略大小写

  10. TGI指数

    TGI指数 目标人群中国具有某一特征的群体占比/总体中具有相同特征的群体的占比*标准数100