问题标题: 酷町堂:1344怎么做

0
0
已解决
芮奥运
芮奥运
高级光能
高级光能

http://judge.codingtang.com/problem/1344/
 

题目描述 Description

输入一个整数n(1=<n<=10),n表示数字123所占据的列宽,先输出n,再对数字123进行右对齐输出。

输入描述 Input Description

输入一行,一个整数。

输出描述 Output Description

先输出第一个数n,再以n为列宽右对齐输出123。

样例输入 Sample Input

 

5

样例输出 Sample Output

 

5 123

 

芮奥运在2018-02-03 17:12:04追加了内容
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n;
    cin >>n;
    printf("%d %nd",n,"123");
    return 0;

0
已采纳
张瑀涵
张瑀涵
高级光能
高级光能
  cout<<n<<setw(n)<<123;

要加头文件#include<iomanip>

0
0
王子凡
王子凡
高级光能
高级光能
cout<<n<<setw(n)<<123;

注意要加头文件iomanip

我要回答