#include<stdio.h> #include<string.h> int main(){ //初始化变量 ... char str[1001][20]; int ct[1001]; //多组测试数据,遇0停止 while(scanf("%d",&n) && n != ...
#include<stdio.h> #include<string.h> int main(){ //初始化变量 ... char str[1001][20]; int ct[1001]; //多组测试数据,遇0停止 while(scanf("%d",&n) && n != ...
java AC代码 import java.io.*; import java.util.Scanner; public class Main{ public static void main(String[] args) { long n,result;... Scanner reader = new Scanner(System.in);... while(rea
标签: hdu1001
hdu1001解题报告
题目描述: 解析: 问题就是求和,关键在于求法: 1.直接套求和公式 ... 2....很明显第一种方法的时间复杂度小,但第一种方法在输入过大时计算会产生溢出,因此,在此题中使用第二种方法。... int flag = ...
Problem Description 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 ...
Tempter of the BoneTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 143919 Accepted Submission(s): 38404Problem DescriptionThe doggie found a ...
HDU 1001 题目:计算1+2…+n #include<stdio.h> double add(double open,double n); int main(void){ double open,n; scanf("%lf",&open); scanf("%lf",&n); double sum=add(open,n); printf("sum...
#include<bits/stdc++.h> using namespace std; int main(){ int a,sum=0; while(scanf("%d",&a)!=EOF){ sum=0; for(int i=0;i<=a;i++){ sum+=i; } cout<<sum<......
HDU1001 原题为: 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 ...
Sum Problem Hey, welcome to HDOJ(Hangzhou Dianzi University Online Judge). In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + … + n. #include &lt;iostream&gt;...
标签: c语言
HDU1001 Sum Problem <一>基本方法累加法 #include<stdio.h> //基本方法累加法 int main() { int n; while(scanf("%d",&n)!=EOF) { int i; int sum=0; for(i=1;i<=n;i++) sum+=i; printf...
import java.util.Scanner; public class Main { public static void main(String[] args) { long n,sum=0,i; Scanner input=new Scanner(System.in); while(input.hasNext()) ... n=input.nextInt();...
HDU 1001 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 ...