G - ASCII
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Description
Since all we know the ASCII code, your job is simple: input numbers and output corresponding messages.
Input
The first line contains one integer T (1<=T<=1000). The input will contain T positive integers separated by whitespaces (spaces, newlines, TABs). The integers will be no less than 32.
Output
Output the corresponding message in just one line. Warning: no extra characters are allowed.
Sample Input
13
72 101 108 108 111 44 32 119 111 114 108 100 33
Sample Output
Hello, world!
题意分析:
这道题就根据ASCII码输出相应的字符就完了。
解题思路:
直接将输入的int类型转化成char输出就完了。
编码:
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; int num[1001]; for (int i = 0; i < t; i++) { cin >> num[i]; } for (int i = 0; i < t; i++) { char temp = (char)num[i]; cout << temp; } return 0; }最后:
唯一的问题是,这道题在输出要求上写了所有的输出都在一行,我第一发最后给加了换行,结果就WA了一发······