hdu 1002(大数)】的更多相关文章

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…
数字的反转: 就是将数字倒着存下来而已.(*^__^*) 嘻嘻…… 大致思路:将数字一位一位取出来,存在一个数组里面,然后再将其变成数字,输出. 详见代码. 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 题意: 数学题,A+B; 思路,这个数非常大,普通加法一定会超时,所以用大数加法.大数加法的基本思路是模拟我们做加法的时候的进位思想,从最低位开始模拟, 在我的代码里 v -- 进位, tmp -- 当前位2个数的和,k -- 答案数组的下标. 其中, tmp/10 可以得到要进的位数, 同理,tmp%10可以得到个位,就是答案数组对应的位 下面是AC代码: #include <iostre…
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…
题目链接>>>>>> 题目大意:手动模拟大数加法,从而进行两个大数的加法运算 #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; #define MAXN 3000 int a[MAXN], b[MAXN]; int main() { int t; scanf(; getchar(); int array[MAXN]; whi…
题目链接 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 integer T(1<=T<=20) which means the number of test cases. Then T li…
题意:就是求a+b (a,b都不超过1000位) 思路:用数组存储 第一道大数的题目,虽然很水,纪念一下! 代码: #include<cstdio> #include<cstring> int main(){ int t,lena,lenb,i,j,sum,testcase=0; char a[1024],b[1024]; char c[1024];//存 a+b int co;//进位 scanf("%d",&t); int tt=t; while(t…
package Main; //import java.io.InputStream; import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { int _case; BigDecimal a,b; a=new BigDecimal("0"); b=new BigDecimal("0"); Sc…
A + B Problem II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 407964    Accepted Submission(s): 79058 Problem Description I have a very simple problem for you. Given two integers A and B, you…