A - ASCII code 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.
Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in “AtCoder Beginners Selection” (https://atcoder.jp/contests/abs).
「競プロ典型 90 問」(Typical 90 Problems of Competitive Programming) (https://atcoder.jp/contests/typical90) is a collection of typical 90 competitive programming problems; unfortunately, currently the problem statements are all Japanese.
「C++入門 AtCoder Programming Guide for beginners (APG4b)」(https://atcoder.jp/contests/APG4b) is a C++ tutorial for competitive programmers. Sadly, this is only in Japanese too.
In this problem, you are asked to convert a character code to a character. Please check how to treat strings and characters in your programming language.
In C language, the value is outputted as a character by specifying an appropriate format specifier.
#include<stdio.h>
int main(){
int n;
scanf("%d",&n);
printf("%c\n",n);
}
You may do so in C++ too, if you use printf. In case of using iostream(cout), you should explicitly cast it to a char type in order to output it as a character.
#include<bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
cout << (char)N << endl;
}
In Python, there is a function chr that converts a character code to a character.
N=int(input())
print(chr(N))
posted:
last update: