字符串要简单就是要跳出字符串吧
我不知道为什么他们写的那么快反正我是过了好几天才优化了这个解法
1.fgets函数读取一整行 scanf会自动到换行符停止的
2.最后的strlen会记录换行符
3.移动n 开头的陷阱一定要取模
4.while循环的优化 看输出吧 反正就一两个的差
include <stdio.h>
include <string.h>
int main()
{
char str[105];
fgets(str,sizeof(str),stdin);
int n;scanf("%d",&n);
int len=strlen(str)-1;
int count=0;int i=n%len;
while(count!=len)
{
printf("%c",str[i]);
i=(i+1)%len;
count++;
}
}