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. 【干货理解】理解javascript中实现MVC的原理

    理解javascript中的MVC MVC模式是软件工程中一种软件架构模式,一般把软件模式分为三部分,模型(Model)+视图(View)+控制器(Controller); 模型:模型用于封装与应用程 ...

  2. nyoj 14 会场安排问题(贪心专题)java

    会场安排问题 时间限制:3000 ms  |  内存限制:65535 KB 难度:4   描述 学校的小礼堂每天都会有许多活动,有时间这些活动的计划时间会发生冲突,需要选择出一些活动进行举办.小刘的工 ...

  3. [转]C++模板学习

    1. 模板的概念. 我们已经学过重载(Overloading),对重载函数而言,C++的检查机制能通过函数参数的不同及所属类的不同.正确的调用重载函数.例如,为求两个数的最大值,我们定义MAX()函数 ...

  4. HTML5 之Canvas 绘制时钟 Demo

    <!DOCTYPE html> <html> <head> <title>Canvas 之 时钟 Demo</title> <!--简 ...

  5. SGU 495. Kids and Prizes

    水概率....SGU里难得的水题.... 495. Kids and Prizes Time limit per test: 0.5 second(s)Memory limit: 262144 kil ...

  6. maven打包步骤_maven 构建项目

    maven打包 1:先在pom文件中添加下面配置  jar <build>        <plugins>            <!-- compiler插件, 设定 ...

  7. c#后台替换html标签的方法

     public static string ReplaceHtmlTag(string html)         {              string strText = System.Tex ...

  8. wp手机 htc x310e

    入手htc x310e 手机不错,用着流畅 不习惯,已升到wp7.8,系统限制还是有些需要的功能没有,比如说短信拦截什么的 我需要的常用软件少 转手了 1 注销windows live? 设置--应用 ...

  9. 第一篇博客 iframe自适应高度

    $('iframe').load(function(){    $(this).height($(this).contents().find(document).height())})这样就适应里面内 ...

  10. python os.path.dirname 是什么目录

    这个获取文件路径中所在的目录. 1 2 3 4 5 6 7 In [1]: import os   In [2]: os.__file__ Out[2]: '/usr/lib/python2.7/os ...