Official

A - Four Digits Editorial by en_translator


If you are new to learning programming and do not know where to start, please try Problem A “Welcome to AtCoder” from practice contest. There you can find a sample code for each language.


You may implement as “receive the input as a string and prepend 0 until its length becomes \(4\),” but in many languages you can achieve the purpose of this problem by specifying an appropriate formatter to the output function.

Sample code (C)

#include<stdio.h>

int main(){
	int n;
	scanf("%d",&n);
	printf("%04d\n",n);
}

Sample code (Python)

N=int(input())
print(f"{N:04d}")

posted:
last update: