主页

1093.A+B for Input-Output Practice (V)

Problem Problem Description Your task is to calculate the sum of some integers. Input Input contains an integer N in the first line, and then N lines follow. Each line starts with a integer M, and then M integers follow in the same line. Output For each group of input integers you should output their sum in one line, and with one line of out...

阅读更多

1095.A+B for Input-Output Practice (VII)

Problem Problem Description Your task is to Calculate a + b. Input The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line. Output For each pair of input integers a and b you should output the sum of a and b, and followed by a blank line. Sample Input 1 5 10 20 Sample Output 6 3...

阅读更多

1092.A+B for Input-Output Practice (IV)

Problem Problem Description Your task is to Calculate the sum of some integers. Input Input contains multiple test cases. Each test case contains a integer N, and then N integers follow in the same line. A test case starting with 0 terminates the input and this test case is not to be processed. Output For each group of input integers you shou...

阅读更多

1091.A+B for Input-Output Practice (III)

Problem Problem Description Your task is to Calculate a + b. Input Input contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the input and this test case is not to be processed. Output For each pair of input integers a and b you should output th...

阅读更多

1090.A+B for Input-Output Practice (II)

Problem Problem Description Your task is to Calculate a + b. Input Input contains an integer N in the first line, and then N lines follow. Each line consists of a pair of integers a and b, separated by a space, one pair of integers per line. Output For each pair of input integers a and b you should output the sum of a and b in one line, and ...

阅读更多

2000.ASCII码排序

Problem Problem Description 输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符。 Input 输入数据有多组,每组占一行,有三个字符组成,之间无空格。 Output 对于每组输入数据,输出一行,字符中间用一个空格分开。 Sample Input qwe asd zxc Sample Output e q w a d s c x z Solution #include<stdio.h> int main(void) { int a,b,c,t,u; char q,w,e; while(scanf("%c%c%c",&q,&w,&e)!=EOF){ ...

阅读更多

2004.成绩转换

Problem Problem Description 输入一个百分制的成绩t,将其转换成对应的等级,具体转换规则如下: 90~100为A; 80~89为B; 70~79为C; 60~69为D; 0~59为E; Input 输入数据有多组,每组占一行,由一个整数组成。 Output 对于每组输入数据,输出一行。如果输入数据不在0~100范围内,请输出一行:“Score is error!”。 Sample Input 56 67 100 123 Sample Output E D A Score is error! Solution #include<stdio.h> int main(void) { int t; while(scanf("%d",&...

阅读更多

2002.计算球体积

Problem Problem Description 根据输入的半径值,计算球的体积。 Input 输入数据有多组,每组占一行,每行包括一个实数,表示球的半径。 Output 输出对应的球的体积,对于每组输入数据,输出一行,计算结果保留三位小数。 Sample Input 1 1.5 Sample Output 4.189 14.137 Hint #define PI 3.1415927 Solution #include<stdio.h> #define PI 3.1415927 int main(void) { double r,tiji; while(scanf("%lf",&r)!=EOF){ tiji=...

阅读更多

2009.求数列的和

Problem Problem Description 数列的定义如下: 数列的第一项为n,以后各项为前一项的平方根,求数列的前m项的和。 Input 输入数据有多组,每组占一行,由两个整数n(n<10000)和m(m<1000)组成,n和m的含义如前所述。 Output 对于每组输入数据,输出该数列的和,每个测试实例占一行,要求精度保留2位小数。 Sample Input 81 4 2 2 Sample Output 94.73 3.41 Solution #include<stdio.h> #include<math.h> int main(void) { int m,n,i; double sum,sqr; while(sc...

阅读更多

2001.计算两点间的距离

Problem Problem Description 输入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离。 Input 输入数据有多组,每组占一行,由4个实数组成,分别表示x1,y1,x2,y2,数据之间用空格隔开。 Output 对于每组输入数据,输出一行,结果保留两位小数。 Sample Input 0 0 0 1 0 1 1 0 Sample Output 1.00 1.41 Solution #include<stdio.h> #include<math.h> int main(void) { float x1,y1,x2,y2,line; while(scanf("%f %f %f %f",&...

阅读更多

1001.Sum Problem

Problem Problem Description Hey, welcome to HDOJ(Hangzhou Dianzi University Online Judge). In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + … + n. 计算1 + 2 + 3 + …… + n的值 Input The input will consist of a series of integers n, one integer per line. Output For each case, output SUM(n) in one line, followed by a blank line. You ma...

阅读更多

1000.A + B Problem

Problem Problem Description Calculate A + B 计算A+B的值 Input Each line will contain two integers A and B. Process to end of file. 每行将会包括两个整数A和B,直到文件结束 Output For each case, output A + B in one line. 对于每一个样例,在另起一行输出A + B Sample Input 1 1 Sample Output 2 Solution   这是我在杭电上刷的第一道题,和leetcode等平台不一样的是,杭电的OJ需要自己写输入函数,这就意味着输入格式也是考察的一个方面,这曾经是无数坑的开端,包括曾经...

阅读更多