HDOJ 1094 A+B for Input-Output Practice (VI)
Problem Description
Your task is to calculate the sum of some integers.
Input
Input contains multiple test cases, and one case one line. Each case starts with an integer N, and then N integers follow in the same line.
Output
For each test case you should output the sum of N integers in one line, and with one line of output for each line in input.
Sample Input
4 1 2 3 4
5 1 2 3 4 5
Sample Output
10
15
import java.util.*;
class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int m=sc.nextInt();
int sum=0;
for(int i=0;i<m;i++){
int a= sc.nextInt();
sum+=a;
}
System.out.println(sum);
}
}
}
相關文章
- A+B for Input-Output Practice (IV) (sdut oj)
- Practice
- airflow practiceAI
- scientifically practice DP
- shell practice 04
- shell practice 06
- shell practice 03
- shell practice 05
- shell practice 07
- Practice| 流程控制
- Best Practice in Writing
- HDOJ2000題Java程式碼Java
- HDOJ:PRO2017字串統計字串
- HDOJ-1398 Square Coins(母函式)函式
- poj 1094 拓撲排序排序
- [Algorithm] 1. A+B ProblemGo
- poj1094 拓撲排序排序
- “Docker Practice”讀書筆記Docker筆記
- yolov5s ncnn practiceYOLOCNN
- A+B 演算法問題演算法
- ZOJ Problem Set - 1094 Matrix Chain MultiplicationAI
- vi命令
- vi editor
- VI 命令
- Spring Boot In Practice (0):基礎Spring Boot
- css best practice for big team and projectCSSProject
- HDU 1040 As Easy As A+B(堆排序)排序
- Python入門:A+B問題Python
- vi(vim)命令
- vi 命令 用法
- vi常用操作
- 常用VI命令
- vi命令用法
- UNIX VI命令
- PAT答案(D進位制的A+B)
- POJ1094[有向環 拓撲排序]排序
- Oracle 12.2 RAC on Linux Best Practice DocumentationOracleLinux
- Practice5.1 測試與封裝5.1封裝