本地编译一切正常并有输出,但是到了在线IDE上啥也没有,不知道哪里写错了
本地环境:
Ubuntu 20.04.4 LTS on Windows 10 x86_64(WSL2)
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
g++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
编译参数:
-O2
-std=c++14
code:
#include<bits/stdc++.h>
using namespace std;
inline void readnum(int &x){
x=0;
char ch=getchar();
while(ch<'0'||ch>'9')ch=getchar();
while(ch>='0'&&ch<='9'){
x=(x<<1)+(x<<3)+(ch^48);
ch=getchar();
}
return;
}
inline void readstr(string &s){
s="";
char ch=getchar();
while(ch!=' '&&ch!='\n'){
s.push_back(ch);
ch=getchar();
}
return;
}
void printnum(int x){
if(x>9)printnum(x/10);
putchar(x%10+48);
}
inline void printstr(string str){
int i(0);
while(str[i]!='\0')
putchar(str[i]),++i;
}
string jam;
int s,t,w;
int main(){
readnum(s),readnum(t),readnum(w);
readstr(jam);
for(int i=1;i<=5;++i){
int pos(0);
++jam[w-1];
for(int j=w-1;j;--j){
if(jam[j]-96>t-pos){
++jam[j-1];
if(j==0)return 0;
}else{
for(int k=j+1;k<=w-1;++k)jam[k]=jam[k-1]+1;
break;
}
++pos;
}
printstr(jam),putchar('\n');
}
}
本地正常输出正确答案,在线IDE上只有'\n'
且换成cin,cout也无法解决