ACM Steps ---- Section1
来源:互联网 发布:linux查看svn账号密码 编辑:程序博客网 时间:2024/05/14 10:31
这里挑选的是两个水题,输入和输出的练习
Sample Input
3
4 1 2 3 4
5 1 2 3 4 5
3 1 2 3
Sample Output
10
15
6
这道题的陷阱在于 输出结果 之间存在 一个空格 最后一个结果之后没有空格;
import java.util.Scanner;
public class PracticeVIII {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n,m,sum;
n = sc.nextInt();
while((n--)>0){
sum = 0;
m = sc.nextInt();
for(int i=0; i<m ; i++){
sum += sc.nextInt();
}
if(n==0){
System.out.println(sum);
}else{
System.out.println(sum);
System.out.println();
}
}
}
}
0 0
- ACM Steps ---- Section1
- ACM Steps ---- Section1
- Steps-ACM
- ACM STEPS
- ACM steps
- 杭州电子科技大学ACM STEP section1
- hdu ACM Steps 1.1
- hdu ACM Steps 1.2
- hdu ACM Steps 1.3
- hdu ACM Steps 2.1
- hdu ACM Steps 2.2
- hdu ACM Steps 2.3
- hdu ACM Steps 3.1
- hdu ACM Steps 3.2
- hdu ACM Steps 3.3
- 【ACM Steps】N!Again
- 【ACM Steps】 Fibonacci
- [ACM Steps]Cake
- iOS新浪微博客户端开发(1)——新特性界面
- storm文档----配置文件说明
- 进程通信-管道 read & write
- Android文件操作
- 历届试题 矩阵翻硬币
- ACM Steps ---- Section1
- C# Json示例
- 问题解决 The hierarchy of the type is inconsistent
- Linux和dos下的换行符
- css行间距字间距首字缩进
- 高通Android 4.4 彩信发送流程
- iOS新浪微博客户端开发(2)——OAuth授权
- IP地址分类及内网IP-备忘
- 清空掉回收站,发现误删了文件怎么办?