UVALive 7270 Osu! Master 水题

题目描述:

“Osu!” is a unique PC rhythm game, which is very popular over the world. The player should follow the rhythm of a song to finish the game.
The game has three kind of elements: hitting circles on the touchscreen, dragging a ball across a fixed path and rotating a spinner very fast,as shown below:
(这里原来有个图但是没用就不放了)
A song is divided into many patterns. There are two kinds of patterns. The first kind is made up of a list of “Hit-circle” elements and “Dragging-ball” elements. The elements are labeled with increasing numbers starting from 1. The player should finish the elements according to the order of the numbers.
The second kind of pattern is made up of only one “Spinner” element with no label.
When a player hits a circle, drags a ball or rotates a spinner, he may get 0pt, 100pts or 300pts according to his performance. If he finishes an element perfectly, he will get 300pts. If a player finishes
a pattern perfectly, which means that he gets 300pts for all elements in this pattern, he will get a“Shock” mark.
Now, give you the number of elements and the kinds of the elements (together with their label) in order, please calculate that how many “Shock” marks a Osu! master can get at most.

Input
Multiply test cases. There are up to 100 test cases.
In every test case:
The first line contains a integer n (0 ≤ n ≤ 10000), representing the number of elements.
Then n lines follow. Each line describes one element in one of the 3 kinds of format shown below :
1. C x — “Hit-circle” with label x
2. B x — “Dragging-ball” with label x
3. S — “Spinner”
It is guaranteed that the input is always valid.

Output
For each test case, output one line, an integer, representing the answer.

Sample Input

10
C 1
C 2
B 3
C 1
B 2
B 1
S
C 1
S
B 1
1
S
0
2
S
B 1

Sample Output

7
1
0
2

题目分析:

2015ACM-ICPC北京的J题。
说了半天题目,其实这题水的不行。
按顺序输入n组数,每一组数有一个字符(‘B’‘C’’S’)如果不是’S’,还带有一个整数。
然后求的就是这输入的输入数字连续的数量,(如果遇到‘S’算单独的一组)
看第一组输入样例:
10
C 1 C 2 B 3
C 1 B 2
B 1
S
C 1
S
B 1
所以输出7,简单吧….

代码如下:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>

using namespace std;

int n;
int main()
{
    while(scanf("%d",&n)!=-1)
    {
        int ans=0;
        int pos=-1;
        char c;
        int x;
        for(int i=1; i<=n; i++)
        {
            cin>>c;
            if(c=='S')
            {
                ans++;
                pos=-1;
            }
            else
            {
                scanf("%d",&x);
                if(x!=pos+1)
                    ans++;
                pos=x;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值