S1006 scanf()可以全部输入数字再点击,程序自动执行
来源:互联网 发布:淘宝手机端红包设置 编辑:程序博客网 时间:2024/06/09 20:58
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.
It is guarantied that all integers and the sum are in the range of 32-int.
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 45 1 2 3 4 5
Sample Output
1015
一,正确方法
# include <stdio.h> int main() { int N,a,sum; while(scanf("%d",&N)!=EOF) {sum = 0;while(N){scanf("%d",&a);sum += a;N--;}printf("%d\n",sum);}return 0; }二,收获体会
这里的scanf可以全部输入数字再点击,即点击一个回车,同时把scanf()赋给N和多个a,并且程序自动执行。
阅读全文
0 0
- S1006 scanf()可以全部输入数字再点击,程序自动执行
- 【jsp】解决table中输入全部为字母或数字时不自动换行问题
- scanf()输入数字和字符
- scanf输入字符和数字的问题
- JTable选择一行,输入数字,自动向前移动一位,点击退格键,删除最后一个数字
- 写个可以自动执行重复动作的Android程序。
- input禁止输入,可以点击
- 自动点击程序
- android 自动执行点击事件
- Form技巧:如果在输入Item之后,可以自动执行GO_BLOCK等内置函数
- eclipse在程序修改后,点击运行可以自动保存,如何设置
- scanf输入
- PHP程序自动执行
- PHP程序自动执行
- 微信小程序 form表单提交 点击键盘的完成自动执行
- 限制输入框只能输入数字(小数可以输入)
- 微信小程序 只能输入数字
- javascript判断输入内容是否全部是数字
- spring Security4 和 oauth2整合 注解+xml混合使用(注意事项篇)
- spring cloud之安全访问(八)
- 织梦读取数据库几个用法
- IntelliJ IDEA检出web工程笔记
- java线程池应用及原理
- S1006 scanf()可以全部输入数字再点击,程序自动执行
- zookeeper集群之开源客户端Curator的使用(五)
- (sqlite3.OperationalError) no such table: users(关键词:Web开发/Flask/数据库/SQLite/bug)
- leetcode_673 Number of Longest Increasing Subsequence
- 让cpu稳定在66%
- Using drop down by key in webdynpro ABAP
- 系统:win10 IDE:pycharm Python版本:2.7 安装第三方插件是报错: 这里写图片描述 报错原因与编码有关,pip把下载的临时文件存放在了用户临时文件中,这个目录一般是C
- SSH-----Struts2的介绍及获取
- 网页中弹出小窗口,页面背景逐渐变为半透明