Codeforces Round #193 (Div. 2) 一道水题的翻译

心情小记:第一次参加codeforce网赛,对于我这种英语拙技的人来说对于这道题目的理解简直要了我的老命,于是我果断放弃了......

尤其是俄式英语,看多了中式英语的我快疯了。

但这道题弄懂了以后,居然出奇的水。。。

对于我来说这道题

以下是我的翻译


几个变量:

n 是人的个数。

bi 是每个人的编号范围是0~n-1

j  是游戏的次数

                                                                    A. Down the Hatch!

All n people who came to the barbecue satin a circle (thus each person received a unique index bi

 from 0 to (n - 1). The person number 0 started the game (this time it was Vasya).All turns in the

 game were numbered by integers starting from 1. If the j-thturn was made by the person with index

 bi, then this person acted like that:

 

参加烧烤的n个人围成一圈,因此每个人都有一个特殊的 编号  bi  从0 ~ n-1

编号为0 的人 (这一轮的0号人是VASYA)开始游戏。游戏的次数计作j次(j>=1),如果第j次是从 编号 bi者开始的,那么这个就要这样做:

1.               he pointed at theperson with index (bi+1) mod n either with an elbow or with a nod

 (x mod y is the remainder after dividing x byy);

2.               if j4 and the players whohad turns number j-1, j-2, j-3, made during their turns the same


 moves as player bi on the current turn, then he had drunk a glass of juice;

3.               the turn went toperson number (bi+1) mod n.

1     他(这个编号 bi 者)用手肘指着、或者对那个 编号为 (bi+1)%n 的家伙点头。

2   如果j大于等于4 ,那么j-1 j-2 j-3轮的玩家,在轮到他们的期间进行和bi玩家在现轮一样的动作,然后bi就要 喝一杯果汁。(感谢冰清玉洁小朋友对这句话的翻译)

3    下一回游戏是 编号为 (bi+1)%n  开始。

 

Theproblem was, Vasya's drunk too much juice and can't remember the goal of thegame. However,

 Vasya's got the recorded sequence of all the participants'actions (including himself). Now Vasya

 wants to find out the maximum amount ofjuice he could drink if he played optimally well (the other

 players' actions donot change). Help him.

You can assume that in any scenario, there is enough juice foreverybody.

现在问题是,vasya 已经喝了太多果汁,但不记得他喝了几杯。

然而,vasya已经知道 所有玩家(包括他自己)的动作顺序。现在他想得出,如果他想玩的特别好喝到最多的果汁,并且别人的动作都不变,他该怎么做?帮帮他


input:

The first line contains asingle integer n (4n2000) — the number ofparticipants in the game. The

 second line describes the actual game: the i-th (应该是i)character of this line equals 'a', if


 theparticipant who moved i-th pointed at the next person with his elbow, and'b', if the participant

 pointed with a nod. The game continuedfor at least 1 and at most 2000 turns.

输入:

参与者数量n   

如果玩家第j次用手肘指着下一个人,第j个字母等于a

如果玩家第j次用对下一个人点头,第j个字母等于b

J的范围是(1~2000)

 Print a single integer — the number of glasses of juice Vasya could have drunk if he had played optimally well.

输出:在他玩的特别好的情况下 vasaya最多能喝几杯饮料



Sample test(s)
input
4
abbba
output
1
input
4
abbab
output
0
Note

In both samples Vasya has got two turns — 1 and 5. In the first sample, Vasya could have drunk a glass of juice during the fifth turn if he had pointed at the next person with a nod. In this case, the sequence of moves would look like "abbbb". In the second sample Vasya wouldn't drink a single glass of juice as the moves performed during turns 3 and 4 are different.


#include<iostream>
#include<string.h>
using namespace std;
int main()
{
    int n,i,k,count=0;
    char str[2000];
    cin>>n>>str;
    for(i=n;i<strlen(str);i=i+n)
    {
    char c=str[i-1];
    if(str[i-2]==c&&str[i-3]==c)
    count++;
    }
    cout<<count<<endl;
    return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值