leon2526 @ 2020-04-16 16:15:33
#include<stdio.h>
int main()
{
char a;
int b,i;
scanf("%d",&b);
for(i=0;i<1;i=i)
{
a=getchar();
if(a+b<='z'){
printf("%c",a+b);
}else{
printf("%c",a+(b%26)-'z'+'a'-1);
}
}
return 0;
}
如上,总是超时。。。。哪位dalao能解答一下吗 万分感谢。。
by 400iq @ 2020-04-16 16:16:58
STO for(i=0;i<1;i=i)
Orz
by hanzhongtlx @ 2020-04-16 16:17:13
无限赋值,不TLE还能AC?
by leon2526 @ 2020-04-16 16:19:48
@bovine__kebi 啊我刚学。。。真的菜
by leon2526 @ 2020-04-16 16:20:50
@hanzhongtlx 明白了。。谢谢谢谢
by bovine__kebi @ 2020-04-16 16:29:30
@leon2526 嘶,好吧教教
for(int i=0;i<1;i++)
直接这样写吧
by liqingyang @ 2020-04-16 16:39:33
@bovine__kebi %%%,数论大师!
by leon2526 @ 2020-04-16 16:39:42
#include<bits/stdc++.h>
int main(){
char a[100];
int b,i;
int j=strlen(a);
scanf("%d%s",&b,&a);
for(i=0;a[i]!='\0';i++){
if(a[i]+b<='z'){
printf("%c",a[i]+b);
}else{
printf("%c",a[i]+(b%26)-'z'+'a'-1);
}
}
return 0;
}
@bovine__kebi 这个为啥还是有一个点过不了啊?