P1563 玩具谜题

链接:Miku

暴力模拟

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<cstring>
using namespace std;
int n,m;
int ma[100001];
map <int,string> pl;
string s;
int f;
int x,y;
int id=1;
void sh(int st){
    if(st+id>n)
    id=st+id-n;
    else
    id=st+id; 
} 
void ni(int st){
    if(st>=id)
    id=n-(st-id);
    else{
        id=id-st;
    }
}
int main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;++i){
        scanf("%d",&f);
        cin>>s;
        ma[i]=f;
        pl[i]=s;
    } 
    for(int i=1;i<=m;++i){
        scanf("%d%d",&x,&y);
        if(ma[id]){
            if(x)
            ni(y);
            else
            sh(y) ;
        }else{
            if(x)
            sh(y);
            else
            ni(y);
        } 
    }
    cout<<pl[id];
    return 0;
}
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇