hdu 1000&hdu1001

1001

#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
    long long n;
    while(~scanf("%I64d",&n))
    {
        printf("%I64d\n\n",((1+n)*n)>>1);
    }
    return 0;
}

1000

import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class hdu1000 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
         Scanner cin=new Scanner (new BufferedInputStream(System.in));
            PrintWriter cout=new PrintWriter(System.out);

            while(cin.hasNextBigInteger())
            {
                BigInteger t=cin.nextBigInteger();
                BigInteger m=cin.nextBigInteger();
                BigInteger ans =0;
                ans=t.add(m);
                System.out.println(ans);

            }
    }

}
时间: 2024-12-29 23:52:29

hdu 1000&hdu1001的相关文章

HDU 1000 A + B Problem(指针版)

A + B Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 654986    Accepted Submission(s): 204210 Problem Description Calculate A + B. Input Each line will contain two integers A and B. Pr

hdu 1000

A + B Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 486513    Accepted Submission(s): 154130 Problem Description Calculate A + B Input Each line will contain two integers A and B. Proc

HDU 1000 A + B Problem

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 题意:输入A,B输出A+B #include <stdio.h> int main() { int a,b; w

HDU 1000 A+B Problem C/C++

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 Author HDOJ C++: 1 int main() { 2 3 int a, b; 4 5 while (

ACM HDU 1000

A + B Problem 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 Author HDOJ 解题思路:非常简单的一道水题,输入两个整数,输出整数的和. 代

水题/hdu 1000 A + B problem

题意 输入a,b,输出a+b: 分析 注意多case Accepted Code 1 /* 2 PROBLEM:hdu1000 3 AUTHER:NicoleLam 4 MEMO:水题 5 */ 6 7 #include<cstdio> 8 int main() 9 { 10 int a,b; 11 while (scanf("%d%d",&a,&b)!=EOF) printf("%d\n",a+b); 12 return 0; 13 }

HDU——算法练习1000 1089-1096

全篇都是讲数字之间的运算的: 由上自下难度逐渐升级 ,没耐心者建议一拉到底: 1000: 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 搜到的答案1000.1:

[ACM]HDU Problem 1000 + Java

//no package name //import when necessary import java.util.Scanner; //it has to be Main class public class Main { public static void main(String[] args){ Scanner input = new Scanner(System.in); //Wrong answer when using while(true) while(input.hasNex

hdu 1207 汉诺塔II (DP+递推)

汉诺塔II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4529    Accepted Submission(s): 2231 Problem Description 经典的汉诺塔问题经常作为一个递归的经典例题存在.可能有人并不知道汉诺塔问题的典故.汉诺塔来源于印度传说的一个故事,上帝创造世界时作了三根金刚石柱子,在一根柱子上从下往