【ACM】hdu_1096_A+BVIII_201307261748
A+B for Input-Output Practice (VIII)
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 73526 Accepted Submission(s): 22760
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 you must note that there is a blank line between outputs.
Sample Input
3
4 1 2 3 4
5 1 2 3 4 5
3 1 2 3
Sample Output
10
15
6
#include <stdio.h>
int main()
{int n,j=0;
scanf("%d",&n);
while(n--)
{int a,i,m,sum=0;
scanf("%d",&m);
for(i=0;i<m;i++)
{
scanf("%d",&a);
sum+=a;
}
printf(j++?"\n%d\n":"%d\n",sum);
}
return 0;
}
【ACM】hdu_1096_A+BVIII_201307261748的更多相关文章
- 高手看了,感觉惨不忍睹——关于“【ACM】杭电ACM题一直WA求高手看看代码”
按 被中科大软件学院二年级研究生 HCOONa 骂为“误人子弟”之后(见:<中科大的那位,敢更不要脸点么?> ),继续“误人子弟”. 问题: 题目:(感谢 王爱学志 网友对题目给出的翻译) ...
- 【ACM】HDU1008 Elevator 新手题前后不同的代码版本
[前言] 很久没有纯粹的写写小代码,偶然想起要回炉再来,就去HDU随便选了个最基础的题,也不记得曾经AC过:最后吃惊的发现,思路完全不一样了,代码风格啥的也有不小的变化.希望是成长了一点点吧.后面定期 ...
- 【ACM】魔方十一题
0. 前言打了两年的百度之星,都没进决赛.我最大的感受就是还是太弱,总结起来就是:人弱就要多做题,人傻就要多做题.题目还是按照分类做可能效果比较好,因此,就有了做几个系列的计划.这是系列中的第一个,解 ...
- 【ACM】那些年,我们挖(WA)过的最短路
不定时更新博客,该博客仅仅是一篇关于最短路的题集,题目顺序随机. 算法思想什么的,我就随便说(复)说(制)咯: Dijkstra算法:以起始点为中心向外层层扩展,直到扩展到终点为止.有贪心的意思. 大 ...
- 【ACM】不要62 (数位DP)
题目:http://acm.acmcoder.com/showproblem.php?pid=2089 杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer).杭州交通管理局经常会扩充一些的士车牌照,新 ...
- 【Acm】八皇后问题
八皇后问题,是一个古老而著名的问题,是回溯算法的典型例题. 其解决办法和我以前发过的[算法之美—Fire Net:www.cnblogs.com/lcw/p/3159414.html]类似 题目:在8 ...
- 【ACM】hud1166 敌兵布阵(线段树)
经验: cout 特别慢 如果要求速度 全部用 printf !!! 在学习线段树 内容来自:http://www.cnblogs.com/shuaiwhu/archive/2012/04/22/24 ...
- 【acm】杀人游戏(hdu2211)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2211 杀人游戏 Time Limit: 3000/1000 MS (Java/Others) M ...
- 【ACM】How many prime numbers
http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=2§ionid=1&problemid=2 #inclu ...
随机推荐
- Get-Acl 查看文件权限
https://blogs.msmvps.com/erikr/2007/09/26/set-permissions-on-a-specific-service-windows/ Get-Acl .\L ...
- go之for循环
一.基于计数器的迭代 格式 for 初始化语句; 条件语句; 修饰语句{} 实例 package main import "fmt" func main(){ for i:=0;i ...
- Redis学习笔记(二)-key相关命令
Redis支持的各种数据类型包括string,list ,set ,sorted set 和hash . Redis本质上一个key-value db,所以我们首先来看看他的key.首先key也是字符 ...
- 解决Latex复制到公众号可能报“图片粘贴失败”的问题
前几天出了个版本,还发了篇“Md2All,让公众号完美显示Latex数学公式”的文章,发完后,心里还是不太爽的,因为那个版本还是遗留了一个问题:当把Latex公式转换为本地图片,再复制到公众号时,有可 ...
- vue axios 请求带token设置
API axios.js import axios from "axios"; let AUTH_TOKEN=(function(){ return localStorage.ge ...
- 【python】数组去重
直接用set就行,比如: l = [1, 1, 2, 2, 3, 4, 5] s = set(l) c = [i for i in s] print c 结果为: [1, 2, 3, 4, 5] 其中 ...
- Yoga710笔记本Win10和Ubuntu系统共存
联想yoga710默认安装了win10系统,且使用EFI分区格式,安装Ubuntu不是一般的困难,经公司小哥的帮助下,几次终于完成了Ubuntu和Win10 共存. 经过多次安装测试,暂时能运行成功的 ...
- 使用replace pioneer批量修改文件名
shell的正则表达式还是很难记忆的,也没有沉静的心情看文档,于是使用了replace pioneer. 1. 启动replace pioneer,Tools->batch runner , ...
- 【sqli-labs】 less31 GET- Blind -Impidence mismatch -Having a WAF in front of web application (GET型基于盲注的带有WAF注入)
标题和less30一样 http://192.168.136.128/sqli-labs-master/Less-31/login.php?id=1&id=2" ")闭合的 ...
- js与Jquery的对比
// document.getElementById("divCommit").style.display="none";// document.g ...