码迷,mamicode.com
首页 > 其他好文 > 详细

NOIP2016 toy

时间:2016-12-04 20:15:35      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:return   int   ret   log   ring   for   style   turn   using   

又是一年noip时

 1 #include<iostream>
 2 using namespace std;
 3 
 4 int n,m,p,q,t=0;
 5 int d[100005];
 6 string s[100005];
 7 
 8 int main()
 9 {
10     cin>>n>>m;
11     for(int i=0;i<n;i++)
12     {
13         cin>>d[i]>>s[i];
14     }
15     for(int i=0;i<m;i++)
16     {
17         cin>>p>>q;
18         if(d[t]==0&&p==0)
19             t=(t-q+n)%n;
20         else if(d[t]==1&&p==0)
21             t=(t+q)%n;
22         else if(d[t]==0&&p==1)
23             t=(t+q)%n;
24         else if(d[t]==1&&p==1)
25             t=(t-q+n)%n;
26     }
27     cout<<s[t]<<endl;
28     return 0;
29 }

 

NOIP2016 toy

标签:return   int   ret   log   ring   for   style   turn   using   

原文地址:http://www.cnblogs.com/InWILL/p/6129662.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!