A + B Problem

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 571020    Accepted Submission(s):
181151

Problem Description
Calculate A + B.
 
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
#include <iostream>
#include <cstdio> using namespace std; int main()
{
int a=,b=;
while(scanf("%d %d",&a,&b)!=EOF){
printf("%d\n",a+b);
}
return ;
}

Sum Problem

Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 410639    Accepted Submission(s):
103262

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.

 
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

#include <iostream>
#include <cstdio>
using namespace std; int main()
{
int t;
int sum=;
while(scanf("%d",&t)!=EOF){
for(int i=;i<=t;i++){
sum+=i;
}
printf("%d\n\n",sum);
sum=;
}
return ;
}

字符串连接:

#include <iostream>
#include <cstdio> using namespace std; int main()
{
char a[]="i love";
char b[]="you!";
char c[];
sprintf(c,"%s %s",a,b);
printf("%s",c);
return ;
}

HDU 1000 & HDU1001 & 字符串连接的更多相关文章

  1. hdu 1000&hdu1001

    1001 #include<iostream> #include<stdio.h> using namespace std; int main() { long long n; ...

  2. hdu 5510 Bazinga(字符串kmp)

    Bazinga Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Sub ...

  3. ytu 1052: 写一函数,将两个字符串连接(水题,指针练习)

    1052: 写一函数,将两个字符串连接 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 343  Solved: 210[Submit][Status][ ...

  4. 关于python字符串连接的操作

    python字符串连接的N种方式 注:本文转自http://www.cnblogs.com/dream397/p/3925436.html 这是一篇不错的文章 故转 python中有很多字符串连接方式 ...

  5. js ES6 多行字符串 连接字符串

    1. 以前,js多行字符串用\n写起来比较费事,所以最新的ES6标准新增了一种多行字符串的表示方法,用` ... `表示: 旧版写法 alert("你好,\n 我叫\n Olive" ...

  6. python字符串连接的N种方式

    python中有很多字符串连接方式,今天在写代码,顺便总结一下: 最原始的字符串连接方式:str1 + str2 python 新字符串连接语法:str1, str2 奇怪的字符串方式:str1 st ...

  7. SQL注入的字符串连接函数

    在select数据时,我们往往需要将数据进行连接后进行回显.很多的时候想将多个数据或者多行数据进行输出的时候,需要使用字符串连接函数.在sqli中,常见的字符串连接函数有concat(),group_ ...

  8. Swift语言—有趣的字符串连接、数组、字典

    字符串链接:Swift语言中的字符串连接方式本人觉得非常的有趣,变量连接需要用右斜杠,并且变量名要括起来 “\(变量名)”,后面的字符串连接分别用逗号 ‘ , ’ 隔开 数组: Var arr = [ ...

  9. python 字符串连接

    字符串连接 方法1: 用字符串的join方法 a = ['a','b','c','d']content = ''content = ''.join(a)print content 方法2: 用字符串的 ...

随机推荐

  1. Netbeans 设置模板

    /** * @Description * @author ${user} * @date ${date} ${time} * @copyright ${copyright} */ 工具-->模板 ...

  2. ScriptManager与UpdatePanel总结

    1.From http://www.cnblogs.com/Tim-Seven/archive/2011/02/11/1952409.html Ajax Extensions 2.ScriptMana ...

  3. 3_mysql 主从复制

    mysql 主从复制 网易数据库 石勇 提纲 什么是主从复制 主从复制的原理 主从复制的用途 主从复制的搭建 主从复制的问题 什么是主从复制 数据拷贝 准实时 源-主节点:目的-从节点 主从复制的原理 ...

  4. ajax状态

    ajax的几个状态 Uninitialized 初始化状态.XMLHttpRequest 对象已创建或已被 abort() 方法重置. Open open() 方法已调用,但是 send() 方法未调 ...

  5. js时间格式化(yy年MM月dd日 hh:mm)

    //时间格式化 Date.prototype.format = function (format) { var o = { "M+": this.getMonth() + 1, / ...

  6. JQuery可见性过滤选择器:hidden无法获取通过visibility:hidden样式隐藏的元素-遁地龙卷风

    1.版本问题 如果你可以获取下列元素 <input type="hidden"/> <div style="display:none"> ...

  7. php删除字符串中的所有空格

    function trimall($str)//删除空格 { $qian=array(" "," ","\t","\n" ...

  8. mysql:You can't specify target table 'bpm_tksign_data' for update in FROM clause

    UPDATE bpm_tksign_data WHERE actinstid ' AND nodeid = 'SignTask1' AND batch = ( SELECT max(a.batch) ...

  9. Interleaving String leetcode

    Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1 = ...

  10. Android学习笔记(四)——再探Intent

    //此系列博文是<第一行Android代码>的学习笔记,如有错漏,欢迎指正! 我们可以使用 Intent 来启动一个活动, 还可以在启动活动的时候传递数据的,下面一起来看一下: 一.向下一 ...