hdu 1002】的更多相关文章

数字的反转: 就是将数字倒着存下来而已.(*^__^*) 嘻嘻…… 大致思路:将数字一位一位取出来,存在一个数组里面,然后再将其变成数字,输出. 详见代码. while (a) //将每位数字取出来,取完为止 { num1[i]=a%; //将每一个各位取出存在数组里面,实现了将数字反转 i++; //数组的变化 a/=; } 趁热打铁 例题:hdu 4554 叛逆的小明 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4554 叛逆的小明 Time…
原题代号:HDU 1002 原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1002 原题描述: Problem Description I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.   Input The first line of the input contains an i…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1002 题目意思:就是大整数加法. 两年几前做的,纯粹是整理下来的. #include <stdio.h> #include <string.h> #define max 1010 char a[max], b[max]; int main() { int i, k, s, c, T, len1, len2; scanf("%d", &T); ; k <…
A + B Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 230395    Accepted Submission(s): 44208 Problem Description I have a very simple problem for you. Given two integers A and B, you…
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1002 复习一下大数 模板: #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> #include <assert.h> #include <ctype.h> #include <map> #include <string&g…
http://acm.hdu.edu.cn/showproblem.php?pid=1002 PE   由于最后一个CASE不须要输出空行 import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String args[]){ Scanner in = new Scanner(System.in); int ncase; ncase = in.nextIn…
A + B Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 347161    Accepted Submission(s): 67385 Problem Description I have a very simple problem for you. Given two integers A and B, you…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1002 题意: 数学题,A+B; 思路,这个数非常大,普通加法一定会超时,所以用大数加法.大数加法的基本思路是模拟我们做加法的时候的进位思想,从最低位开始模拟, 在我的代码里 v -- 进位, tmp -- 当前位2个数的和,k -- 答案数组的下标. 其中, tmp/10 可以得到要进的位数, 同理,tmp%10可以得到个位,就是答案数组对应的位 下面是AC代码: #include <iostre…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1002 Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. InputThe first line of the input contains an integer T(1<=T<=20) whic…
昨天做的那题其实和大整数相加类似.记得当初我大一寒假就卡在这1002题上,结果之后就再也没写题... 到今天终于把大整数相加写了一遍. 不过写的很繁琐,抽时间改进一下写简洁一点. #include<queue> #include<math.h> #include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> using namespace std;…