HDU 2162(注意初始化位置!)
Add ‘em
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4144 Accepted Submission(s): 2976
-1
3
1
1
2
19
17
5
-645
952
-1488
-5456
-9342
-1
Sum of #2 is 36
Sum of #3 is -15979
#include <iostream>
#include<cstdio>
using namespace std; int main()
{
int t,a,sum,c=1;
while(~scanf("%d",&t))
{
if(t<=0)
break;
sum=0;
//c=1;//注意位置,不是这里初始化!
while(t--)
{
scanf("%d",&a);
sum+=a;
}
printf("Sum of #%d is %d\n",c++,sum);
}
return 0;
}
HDU 2162(注意初始化位置!)的更多相关文章
- 关于C++中static初始化位置
编译原理作业中关于static的初始化位置问题: 在.h文件中这样声明了一个静态数据成员 class Expression { private: static std::vector<Ident ...
- WinForm------窗体初始化位置的显示
在窗体的构造方法里面添加 public Form2() { InitializeComponent(); //指定窗口初始化时的位置(计算机屏幕中间) this.StartPosition = For ...
- HDU 2162 Add ‘em
http://acm.hdu.edu.cn/showproblem.php?pid=2162 Problem Description Write a program to determine the ...
- javascript变量初始化位置
变量在之前<script type="text/javascript"></script>(或引用的js文件)中初始化,可以正常访问. 运行程序:弹出123 ...
- HDOJ(HDU) 2162 Add ‘em(求和)
Problem Description Write a program to determine the summation of several sets of integers. Input Th ...
- Android模拟位置信息
Android模拟位置程序,俗称GPS欺骗,只能修改采用GPS定位的软件. 手机定位方式目前有4种:基站定位,WIFI定位,GPS定位,AGPS定位 常见的修改手法: 1. 抓包欺骗法,抓包改包欺骗服 ...
- c++ RAII 资源管理就是初始化
RAII:(Resource Acquisition Is Initialization),也就是“资源获取就是初始化”,是C++语言的一种管理资源.避免泄漏的惯用法.C++标准保证任何情况下,已构造 ...
- HDU 2164(模拟)
Rock, Paper, or Scissors? Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Jav ...
- HDU 1010 Tempter of the Bone heuristic 修剪
的问题是,在测试修剪. 应该说是更先进的应用. 由于使用的heuristic(经验)修剪.总结这方面的经验法则,别easy.我说,这也是由于先进的在线报告中的应用程序没有分析太多太好的解决这个问题,计 ...
随机推荐
- [Leetcode] Balanced binary tree平衡二叉树
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary ...
- [Leetcode] search a 2d matrix 搜索二维矩阵
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the follo ...
- 如何解析Json返回的数据
Json在Web开发的用处非常广泛,作为数据传递的载体,如何解析Json返回的数据是非常常用的.下面介绍下四种解析Json的方式: Part 1 var list1 = [1,3,4]; alert( ...
- Codeforces Round #524 (Div. 2) A. Petya and Origami
A. Petya and Origami 题目链接:https://codeforc.es/contest/1080/problem/A 题意: 给出n,k,k表示每个礼品里面sheet的数量(礼品种 ...
- git学习,哇瑟说实话我想要的
1.Git 简介及安装Git是目前世界上最先进的分布式版本控制系统(没有之一).它的诞生也颇具传奇,Linux创始人Linus花了两周时间自己用C写了一个分布式版本控制系统,这就是Git!有兴趣的话, ...
- remove computer from join with powershell
Removes the local computer from its domain. Remove-Computer [-UnjoinDomainCredential] <PSCredenti ...
- python函数超时,用装饰器解决 func_timeout
https://zhuanlan.zhihu.com/p/39743129 https://www.jianshu.com/p/a7fc98c7af4d https://ixyzero.com/blo ...
- jquery学习之事件委派
一.定义 事件委派的定义就是,把原来加给子元素身上的事件绑定在父元素身上,就是把事件委派给父元素. 二.版本 从jQuery1.7开始,jQuery引入了全新的事件绑定机制,on()和off()两个函 ...
- Sencha touch中Ext.List的使用及高度自适应
最近在做 Sencha 的一个项目,需要用到 Ext.List 来列出所需商品及相关信息,平时我们使用 Ext.List 都是使用 fullscreen:true 来设置 List 全屏显示, 但 ...
- 设计模式功能概述(Design Patterns)
1.Abstract Factory:提供一个创建一系列相关或相互依赖对象的接口,而无需指定它们具体的类. 2.Adapter:将一个类的接口转换成客户希望的另一个接口.Adapter模式使得原本由于 ...