# 输入输出练习

## 1、hdu 1000

import java.util.*;
public class Main
{
public static void main(String[] args)
{
int a , b;
Scanner cin = new Scanner(System.in);
while(cin.hasNextInt())
{
a = cin.nextInt();
b = cin.nextInt();
System.out.println(a+b);
}
}
}

## 2、hdu 1001

import java.util.*;
public class Main
{
public static void main(String[] args)
{
int n , sum;
Scanner cin = new Scanner(System.in);
while(cin.hasNext())
{
n = cin.nextInt();
if(n % 2 == 0)
sum = n / 2 * (1 + n);
else
sum = (1 + n) / 2 * n;
System.out.println(sum);
System.out.println();
}
}
}

## 3、hdu 1089

import java.util.*;
public class Main
{
public static void main(String[] args)
{
int a , b;
Scanner cin = new Scanner(System.in);
while(cin.hasNext())
{
a = cin.nextInt();
b = cin.nextInt();
System.out.println(a+b);
}
}
}

## 4、hdu 1090

import java.util.*;
public class Main
{
public static void main(String[] args)
{
int n , a , b;
Scanner cin = new Scanner(System.in);
while(cin.hasNext())
{
n = cin.nextInt();
for(int i = 0; i < n; i++)
{
a = cin.nextInt();
b = cin.nextInt();
System.out.println(a+b);
}
}
}
}

## 5、hdu 1091

import java.util.*;
public class Main
{
public static void main(String[] args)
{
int a , b;
Scanner cin = new Scanner(System.in);
while(cin.hasNext())
{
a = cin.nextInt();
b = cin.nextInt();
if(a==0 && b==0) break;
System.out.println(a+b);
}
}
}

## 6、hdu 1092

import java.util.*;
public class Main
{
public static void main(String[] args)
{
int num, sum, n;
Scanner cin = new Scanner(System.in);
while(cin.hasNext())
{
n = cin.nextInt();
if(n == 0) break;
sum = 0;
for(int i = 0; i < n; i++)
{
num = cin.nextInt();
sum += num;
}
System.out.println(sum);
}
}
}

## 7、hdu 1093

import java.util.*;
public class Main
{
public static void main(String[] args)
{
int num, sum, n, m;
Scanner cin = new Scanner(System.in);
while(cin.hasNext())
{
m = cin.nextInt();
for(int i = 0; i < m; i++)
{
n = cin.nextInt();
sum = 0;
for(int j = 0; j < n; j++)
{
num = cin.nextInt();
sum += num;
}
System.out.println(sum);
}
}
}
}

## 8、hdu 1094

import java.util.*;
public class Main
{
public static void main(String[] args)
{
int num, sum, n;
Scanner cin = new Scanner(System.in);
while(cin.hasNext())
{
n = cin.nextInt();
sum = 0;
for(int i = 0; i < n; i++)
{
num = cin.nextInt();
sum += num;
}
System.out.println(sum);
}
}
}

## 9、hdu 1095

import java.util.*;
public class Main
{
public static void main(String[] args)
{
int a , b;
Scanner cin = new Scanner(System.in);
while(cin.hasNext())
{
a = cin.nextInt();
b = cin.nextInt();
System.out.println(a+b);
System.out.println();
}
}
}

## 10、hdu 1096

import java.util.*;
public class Main
{
public static void main(String[] args)
{
int num , sum , n , m;
Scanner cin = new Scanner(System.in);
while(cin.hasNext())
{
m = cin.nextInt();
for(int i = 0; i < m; i++)
{
n = cin.nextInt();
sum = 0;
for(int j = 0; j < n; j++)
{
num = cin.nextInt();
sum += num;
}
System.out.println(sum);
if(i < m-1) System.out.println();
}
}
}
}

• 本文已收录于以下专栏：

举报原因： 您举报文章：杭电acm阶段之理工大版--第一阶段开始入门解题代码（1） 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)