Description
瓦徳老鼠很喜欢字母,他们拥有一个无限循环的字母表,如下: a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w x y z a b c d e f g h i j k l m n o p q r s t u v w ... 瓦徳老鼠很调皮,它每时每刻都在按照某一规则变幻着自己的位置(防止你抓住他): 它在某一个初始位置字母a上,之后每秒都会向前跳K步到相应字母,如: 'n'每一时刻会向前跳3步,第一时刻变为'q',第二时刻变为't'..... 'w'每一时刻会向前跳2步,第一时刻变为'y',第二时刻变为'a'..... 现在给定瓦徳老鼠所在的位置字母a,以及向前跳的步数K,问经过T时刻,瓦徳老鼠在哪一个字母上?
Format
Input
第一行询问数n(0<n<=100) 接下来n行询问,每行给出一个字母a['a'..'z'],向前跳的步数K和时刻T
Output
共n行,每行对应一个询问的答案
Samples
输入数据 1
3
a 2 2
n 3 1
n 3 2
Copy
输出数据 1
e
q
t
代码
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e6+10;
const int INF=0x3f3f3f3f;
int read(){int x=0,ans=1;char c=getchar();while(c>'9'||c<'0'){if(c=='-')ans=-1;c=getchar();}while(c>='0'&&c<='9'){x=x*10+(c-'0');c=getchar();}return x*ans;}
ll n,K,T;
char a;
signed main(){
cin>>n;
while(n--){
cin>>a,K=read(),T=read();
int tmp=(a-'a'+K*T)%26;
char ans=tmp+'a';
cout<<ans<<endl;
}
}