杭电OJ | 1000、1001、1089、1090、1091、1095、1001、1064_杭电1000与1089区别-程序员宅基地

技术标签: 杭电OJ  程序设计  

1000

Input

Each line will contain two integers A and B. Process to end of file.

Output

For each case, output A + B in one line.

Sample Input

1 1

Sample Output

2

要点:注意审题,EOF。

#include <stdio.h>
int main(){
    int a, b;
    while(scanf("%d%d",&a,&b)!=EOF){
        printf("%d\n",a+b);
    }
    return 0;
}

1089

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 in one line, and with one line of output for each line in input. 

Sample Input

1 5

10 20

Sample Output

6

30

代码和1000一样。

1090

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 with one line of output for each line in input. 

Sample Input

2

1 5

10 20

Sample Output

6

30

要点:注意循环条件吧

#include <stdio.h>
int main(){
    int linenum;
    scanf("%d",&linenum);
    for(;linenum!=0;linenum--){
    int a,b;
    scanf("%d %d",&a,&b);
        printf("%d\n",a+b);
    }
    return 0;
}

1091

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 the sum of a and b in one line, and with one line of output for each line in input. 

Sample Input

1 5

10 20

0 0

Sample Output

6

30

要点:||和&&的用法

#include <stdio.h>
int main(){
    int a,b;
    while((scanf("%d%d",&a,&b)!=EOF)&&(a!=0||b!=0)){
        printf("%d\n",a+b);	
    }
    return 0;
}

1095

代码与1089只差printf加一个\n

1001

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 may assume the result will be in the range of 32-bit signed integer.

Sample Input

1

100

Sample Output

1

5050

要点:1. 注意换行。2.注意循环

#include <stdio.h>
int main(){
    int a;
    int sum = 0;
    while(scanf("%d",&a)!=EOF){
	    printf("%d\n\n",sumer(a));	
	}
	return 0;
}
int sumer(int a){
	int adder = 1;
	int sum = 0;
	while(adder!=a+1){
		sum = sum+adder;
		adder++;
	}
	return sum;
}

1064

Input

The input will be twelve lines. Each line will contain the closing balance of his bank account for a particular month. Each number will be positive and displayed to the penny. No dollar sign will be included.

Output

The output will be a single number, the average (mean) of the closing balances for the twelve months. It will be rounded to the nearest penny, preceded immediately by a dollar sign, and followed by the end-of-line. There will be no other spaces or characters in the output.

Sample Input

100.00 489.12 12454.12 1234.10 823.05 109.20 5.27 1542.25 839.18 83.99 1295.01 1.75

Sample Output

$1581.42

#include <stdio.h>
int main(){
	int i;
	double sum=0.0;
	for(i=0;i<12;i++){
		double input;
		scanf("%lf",&input);
		sum = sum+input;
	}
	sum = sum/12.0;
	printf("$%.2f\n",sum);
	return 0;
}

 

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_41924481/article/details/97956871

智能推荐

python使用turtle库绘制一个100长度的十字架_Python:turtle库的使用及图形绘制-程序员宅基地

文章浏览阅读3.6k次。一.绘制一个八边形使用turtle库,绘制一个八边形代码:from turtle import *setup(800,800,20,20)penup()left(90)fd(350)left(90)fd(200)pencolor('pink')pensize(25)pendown()fd(-250)left(135)for i in range(7):fd(250)right(45)done()效..._如何用turtle库画十字

因为延迟执行引起的一次内存泄漏的排查_循环调用 schedulewithfixeddelay 导致内存溢出-程序员宅基地

文章浏览阅读1.6k次。还是按照常规思路,先查GC日志,定位为缓慢累计的内存泄露问题。然后把dump文件加载出来,最后的结果如下两个关于线程池的类的对象和一个关于业务代码的内部类。很快定位到了如下代码 getScheduledThreadPoolExecutor().scheduleWithFixedDelay(new Runnable() { @Override ..._循环调用 schedulewithfixeddelay 导致内存溢出

oracle磁盘提取工具,oracle的磁盘测试工具orion-程序员宅基地

文章浏览阅读35次。很久没用,拿出来上线前再用下:用法:-run [normal]||[advanced]-testname :名称和你的文件名对应-num_disks:硬盘数量-size_small: 小的随机工作量的IO的大小(KB)。size_large: 大的随机的或者连续工作量的大小(KB)-type:大的IO的工作类型(默认是rand):rand:大的随机的IO。seq:大的连续的IO生成文件:_iops..._oracle orion num_disks

用剪映将无字幕的英文视频翻译成中文字幕(附教程+软件)-程序员宅基地

文章浏览阅读1.3w次,点赞3次,收藏10次。点击上方蓝字"优派编程"选择“加为星标”,第一时间关注原创干货原文地址https://www.fang1688.cn/ziyuan/2886.html简介:剪映字幕翻译及SRT字幕导出功能:剪映字幕翻译及SRT字幕导出功能,更加方便的制作视频,更快捷的方式完成剪映字幕翻译及导出【无字幕英语翻译中文字幕】剪映怎么把无字幕的外文视频翻译成制作成字幕?打开电脑版剪映 导入视频 ..._剪映字幕翻译

Win10出现“你需要权限才能执行此操作”提示的解决方法--win7w.com_windows10你需要权限来执行此操作-程序员宅基地

文章浏览阅读6.6k次,点赞2次,收藏5次。不少小伙伴刚开始使用Windows10系统,会发现里面有很多设置跟以往的XP、win7相差甚远,例如在修改删除文件的时候,往往会出现“你需要权限才能执行此操作”的提示,让你无法继续操作。那么要如何解决账号无权限的问题呢?下面小编就为大家带来Windows10账号权限的设置方法。Windows10出现“你需要权限才能执行此  详细如下:  1、右键点击你要修改的文件,选择属性;2、然后点击【安全】选项卡,再点击【高级】按钮;3、进入高级设置中,再点击“更改”;4、在选择用户和组中,我们再点击高级_windows10你需要权限来执行此操作

Nature Protocols | 跨界网络分析(TkNA):用于推断主宿–微生物组和多组学互作的因果关系...-程序员宅基地

文章浏览阅读129次。遗传学和表观遗传学之间的复杂关系是人类健康和疾病的基础。实验和计算能力的进步已经从生物系统的研究中产生了各种各样的高通量数据。大量的技术努力致力于增加吞吐量,并提高实验和计算效率。因此,人们对可以整合不同类型的组学数据并进行关联分析以识别重要参与者和机制的计算方法和软件有明显的兴趣。2024年3月13日,俄勒冈州立大学Andrey Morgun教授团队在Nature Protocols上发表了..._transkingdom 微生物

随便推点

Kubernetes kubectl 命令自动补全_kubectl tab联系-程序员宅基地

文章浏览阅读1.0k次。k8s 命令自动补全yum install -y bash-completionsource /usr/share/bash-completion/bash_completionsource <(kubectl completion bash)echo “source <(kubectl completion bash)” >> ~/.bashrc..._kubectl tab联系

Window10系统下触摸板失灵了 该咋处理_elan pointing device-程序员宅基地

文章浏览阅读7.4k次,点赞3次,收藏7次。之前出现这一类问题,一般都是比较容易解决的,但这一次比较特殊一点,本人是重装系统后出现的问题,下面我会逐步分析并解决这类问题。  如有错误之处,请多多指教(●ˇ∀ˇ●)一、分析原因帮别人电脑重装系统后,结果发现触摸板失灵了!这还是第一次见过~~之前重装过好几次,都没有出现这类问题,这次竟然中奖了哈哈,回归主题,我当时分析了两点1、触摸板被????起来了2、触摸板驱动被误删了注:那时我还查看了window安全系统,发现她一直提醒了有些系统未更新..._elan pointing device

java中时间的相减_java 时间相减-程序员宅基地

文章浏览阅读2.4w次,点赞2次,收藏30次。 /* * 计算两个时间间隔 */ Date date = new Date();// 创建Date类型对象 // 创建SimpleDateFormat类型对象、 "yyyy-MM-dd HH:ss:mm.SSS"是正则式,分别表示年月日时分秒毫秒 SimpleDateF..._java 时间相减

计算机毕业设计ssm基于ssm框架的图书管理系统的设计47xk69(附源码)新手必备-程序员宅基地

文章浏览阅读203次。选题背景:随着数字化时代的到来,图书管理系统在图书馆和其他文化机构中扮演着重要的角色。传统的图书管理方式存在着诸多问题,如信息不透明、借还流程繁琐、查询效率低等。为了提高图书管理的效率和服务质量,设计和实现一个基于SSM框架的图书管理系统具有重要的选题背景。该系统可以提供图书信息的在线管理、借还流程的自动化处理、读者查询的快捷方便等功能,为图书馆和读者提供更好的图书管理体验。意义:基于SSM框架的图书管理系统的设计与实现对于图书馆和其他文化机构具有重要的意义。首先,该系统可以提高图书管理的效率和服务

xss,csrf_xss csfr-程序员宅基地

文章浏览阅读937次。文章转自:csrf介绍:https://www.cnblogs.com/shytong/p/5308667.htmlhttp://www.cnblogs.com/hyddd/archive/2009/04/09/1432744.htmlhttps://www.cnblogs.com/cxying93/p/6035031.htmlxss介绍:https://www.cnblogs..._xss csfr

outlook安全模式修复_Outlook Com安全漏洞Microsoft无法修复-程序员宅基地

文章浏览阅读2.3k次。outlook安全模式修复Microsoft is one of the biggest tech companies in the world, and yet their online email service, Outlook.com, does very little to protect its users from one of the most dangerous cyber cr..._outlook cybersecurity advice

推荐文章

热门文章

相关标签