1014人阅读 评论(0)

# 输入输出练习

## 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();
}
}
}
}

2
0

* 以上用户言论只代表其个人观点，不代表CSDN网站的观点或立场
个人资料
• 访问：65697次
• 积分：1224
• 等级：
• 排名：千里之外
• 原创：55篇
• 转载：14篇
• 译文：0篇
• 评论：3条
阅读排行