1v7w @ 2021-02-04 17:04:15
代码如下
#include <cstdio>
#include <cstring>
long long n, len, m;
char str[50];
int main(){
scanf("%s", str+1);
scanf("%d", &n);
len = strlen(str+1);
while(n>len){
n = n-1; m=len;
while(n>m) m*=2;
if(n!=m) n-=m/2;
}
printf("%c", str[n]);
return 0;
}
by Troubadour @ 2021-06-05 08:25:51
@1v7w
scanf("%d", &n);
改成
scanf("%lld", &n);
因为您的n是 long long
by 1v7w @ 2021-06-16 18:21:36
@Thranduil 感谢感谢!