HDU 3361 ASCII

来源:互联网 发布:定向数据流量 编辑:程序博客网 时间:2024/06/05 20:38
Problem 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
1372 101 108 108 111 4432 119 111 114 108 100 33
 

Sample Output
Hello, world!
 

题意:


根据所给的ASCll打印出相应的字符(可能所给数字不是ASCll)


代码:

#include<stdio.h>#include<string.h>using namespace std;int main(){int n,i;char s[100];int len=0;scanf("%d",&n);for(i=0;i<n;i++){int a;scanf("%d",&a);if(a>=0&&a<=256) s[len++]=a; //ASCll范围[0,256] } s[len]='\0'; printf("%s",s);  return 0;}