Description
“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.
Hit-circle Dragging-ball Spinner
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
“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.
Hit-circle Dragging-ball Spinner
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
题意:给你一系列操作x y
x表示操作种类,y表示操作序号
S则无序号
序号连续则为一套操作,问你一共有多少套操作
签到题。直接维护y即可
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int n;
string x;
int xx,lx;
int i;
int ans;
while(cin>>n)
{
ans=0;
lx=-1;
for(i=1;i<=n;i++)
{
cin>>x;
if(x=="S")
{
ans++;
lx=-1;
}
else
{
scanf("%d",&xx);
if(xx!=lx+1)
ans++;
lx=xx;
}
}
// ans++;
// if(n==0)
// ans=0;
printf("%d\n",ans);
}
return 0;
}