怎么在输出中间加空格a

P1307 [NOIP2011 普及组] 数字反转

white_whale @ 2022-11-06 18:55:32

#include<iostream>
#include<cmath>
using namespace std;
int main(){
    long long n;
    cin>>n;
    if(n<0){
        cout<<"-";
        n=abs(n);
    }
    long long x=0;
    while(n>0){
        x=x*10+n%10;
        n/=10;
    }
    cout<<x<<endl;
}

帮帮忙吧! 小蒟蒻一枚,恳请大佬帮忙


by Li_mz__ @ 2022-11-06 18:58:47

@white_whale

#include<iostream>
#include<cmath>
using namespace std;
int main(){
    long long n;
    cin>>n;
    if(n<0){
        cout<<"-";
        n=abs(n);
    }
    long long x=0;
    while(n>0){
        x=x*10+n%10;
        n/=10;
    }
    cout<<x<<endl;
}

这是你的

#include<iostream>
#include<cmath>
using namespace std;
int main(){
    long long n;
    cin>>n;
    if(n<0){
        cout<<"-";
        n=abs(n);
    }
    long long x=0;
    while(n>0){
        x=x*10+n%10;
        n/=10;
    }
    cout<<x<<" "<<endl;
}

这是加了空格的


by hanpiikun @ 2022-11-06 19:11:37

大悲,一个做出省选/NOI-的人不会入门


by Kniqht @ 2022-11-06 19:15:23

@hanpiikun 典中典


by white_whale @ 2022-11-06 19:22:10

@Li_mz__ ……这我也知道啊


by white_whale @ 2022-11-06 19:23:15

@hanpiikun 好久没刷了,以前一直在xjoi刷的,现在都懒得想


by hanpiikun @ 2022-11-07 09:54:29

@qi136 ?


|