C#处理输入输出
牛客OJ在线编程常见输入输出练习场
https://ac.nowcoder.com/acm/contest/5647
A A+B(1)
let line;
while(line = readline()){
let [a, b] = line.split(' ').map(Number);
console.log(a+b);
}
B A+B(2)
let t = parseInt(readline());
while(t--){
let [a, b] = readline().split(' ').map(Number);
console.log(a+b);
}
C A+B(3)
let line;
while(line = readline()){
let [a, b] = line.split(' ').map(Number);
if(a == 0 && b == 0){
break;
}
console.log(a+b);
}
D A+B(4)
let line;
while(line = readline()){
let [n, ...nums] = line.split(' ').map(Number);
if(n == 0){
break;
}
let sum = 0;
for(let i=0; i<n; i++){
sum += nums[i];
}
console.log(sum);
}
E A+B(5)
let t = parseInt(readline());
for(let i=0; i<t; i++){
let [n, ...nums] = readline().split(' ').map(Number);
let sum = 0;
for(let i=0; i<n; i++){
sum += nums[i];
}
console.log(sum);
}
F A+B(6)
let line;
while(line = readline()){
let [n, ...nums] = line.split(' ').map(Number);
let sum = 0;
for(let i=0; i<n; i++){
sum += nums[i];
}
console.log(sum);
}
G A+B(7)
let line;
while(line = readline()){
let nums = line.split(' ').map(Number);
let sum = 0;
for(let i=0; i<nums.length; i++){
sum += nums[i];
}
console.log(sum);
}
H 字符串排序(1)
let n = parseInt(readline());
let strs = readline().split(' ');
strs.sort();
console.log(strs.join(' '));
I 字符串排序(2)
let line;
while(line = readline()){
let strs = line.split(' ');
strs.sort();
console.log(strs.join(' '));
}
J 字符串排序(3)
链接:https://ac.nowcoder.com/acm/contest/5647/J
输入描述:
多个测试用例,每个测试用例一行。
每行通过,隔开,有n个字符,n<100
输出描述:
对于每组用例输出一行排序后的字符串,用’,'隔开,无结尾空格
let line;
while(line = readline()){
let strs = line.split(',');
strs.sort();
console.log(strs.join(','));
}