justinjia @ 2021-02-11 08:46:11
//既然你们不让我
测试点编号 | 状态 |
---|---|
源代码
#include"stdio.h"
#include"iostream"
#include"string"
using namespace std;
#define int long long
string rotate(string a){
char c=a[a.size()-1];
a.erase(a.size()-1,1);
string tmp="";
tmp+=c;
a.insert(0,tmp);
return a;
}
signed main(void){
string s;
cin>>s;
int n;
scanf("%lld",&n);
while(s.size()<n)
s+=rotate(s);
printf("%c",s[--n]);
return 0;
}
by cmll02 @ 2021-02-11 08:48:57
by justinjia @ 2021-02-11 08:50:32
@cmll02 那我用啥存?字符数组的话估计得全
by cmll02 @ 2021-02-11 08:51:10
这题显然不是暴力啊……得找规律的吧……
by justinjia @ 2021-02-11 08:56:36
@cmll02 请问这个东东有甚么规律???
by justinjia @ 2021-02-11 08:57:23
我看算法标签说递归可这也递归不了啊。
by WanderingTrader @ 2021-02-11 09:23:59
@justinjia 那是你太菜了 不代表不可能(逃)
by justinjia @ 2021-02-11 09:26:08
@wandering_trader 对啊,我实在是太蒻了。
PS:我刚才递推了一下也没发现什么规律。。。
by SubscribeDiana @ 2021-02-11 09:38:55
by WanderingTrader @ 2021-02-11 09:39:29
@Magnanimous 哈哈
by justinjia @ 2021-02-11 09:46:26
@Magnanimous
勿滥用「表情符号」和「HTML」
我有吗??