POJ 2389
#include <iostream>
#include <algorithm>
#include <string>
#define MAXN 300
using namespace std; int tem[MAXN]; void big_int_mul(string a,string b,string & ans); int main()
{
//freopen("acm.acm","r",stdin);
string a;
string b;
string ans;
cin>>a>>b;
big_int_mul(a,b,ans);
cout<<ans<<endl;
} void big_int_mul(string a,string b,string & ans)
{
int len_1 = a.length();
int len_2 = b.length();
int len = a.length() + b.length();
int i;
int j;
for(i = ; i < len_1; ++ i)
{
for(j = ; j < len_2; ++ j)
{
tem[i+j+] += (a[i]-'')*(b[j] - '');
}
}
for(i = len - ; i > ; -- i)
{
if(tem[i] >= )
{
tem[i-] += tem[i]/;
tem[i] %= ;
}
}
j = ;
while(tem[j] == )
{
++ j;
} for(; j < len; ++ j)
{
ans += char(tem[j]+'');
}
}
POJ 2389的更多相关文章
- POJ 2389 Bull Math(水~Java -大数相乘)
题目链接:http://poj.org/problem?id=2389 题目大意: 大数相乘. 解题思路: java BigInteger类解决 o.0 AC Code: import java.ma ...
- poj 2389.Bull Math 解题报告
题目链接:http://poj.org/problem?id=2389 题目意思:就是大整数乘法. 题目中说每个整数不超过 40 位,是错的!!!要开大点,这里我开到100. 其实大整数乘法还是第一次 ...
- qau-国庆七天乐——B
B - Bull Math Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu Sub ...
- Poj OpenJudge 百练 2389 Bull Math
1.Link: http://poj.org/problem?id=2389 http://bailian.openjudge.cn/practice/2389/ 2.Content: Bull Ma ...
- POJ 题目分类(转载)
Log 2016-3-21 网上找的POJ分类,来源已经不清楚了.百度能百度到一大把.贴一份在博客上,鞭策自己刷题,不能偷懒!! 初期: 一.基本算法: (1)枚举. (poj1753,poj2965 ...
- (转)POJ题目分类
初期:一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. ...
- poj分类
初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. ( ...
- poj 题目分类(1)
poj 题目分类 按照ac的代码长度分类(主要参考最短代码和自己写的代码) 短代码:0.01K--0.50K:中短代码:0.51K--1.00K:中等代码量:1.01K--2.00K:长代码:2.01 ...
- POJ题目分类(按初级\中级\高级等分类,有助于大家根据个人情况学习)
本文来自:http://www.cppblog.com/snowshine09/archive/2011/08/02/152272.spx 多版本的POJ分类 流传最广的一种分类: 初期: 一.基本算 ...
随机推荐
- c++中如何定义编译期间常量,即这个常量可以用于定义数组下标
在c++中,类里面的成员变量不仅仅可以被const修饰,还可以被static const修饰,此时一个内建类型(如int ,char ,long等)的static const 可以看做是一个编译期间的 ...
- 跳出思维定势,改变交谈习惯zz
一直以来我都是一个不折不扣的作者所划分的内向者,羞于在公众场合说话,也不愿意与陌生人交谈,甚至是与认识的人聊天,有时候也是一种痛苦,看着在办公室里夸夸其谈的同事们,我总是感觉格格不入.严格说来,我算是 ...
- 2018.10.16 spoj Can you answer these queries V(线段树)
传送门 线段树经典题. 就是让你求左端点在[l1,r1][l1,r1][l1,r1]之间,右端点在[l2,r2][l2,r2][l2,r2]之间且满足l1≤l2,r1≤r2l1\le l2,r1 \l ...
- 2018.10.02 NOIP模拟 矩阵分组(二分答案)
传送门 考场上并不会写二分的check函数,下来看了看题解发现真是妙极. 不难想到每次直接从四个角各按阶梯状拓展出合法区域A,再检验B是否合法就行了.(然而考场上写的弃疗了) 于是题解用了一些小技巧优 ...
- 日历时间选择控件---3(支持ie、火狐)
效果展示: 源代码: <script language=javascript ><!--/* 调用方法:不能用onfocus,要用onclick <input onclic ...
- The class cn.itcast.web.common.util.UtilFuns specified in TLD for the function selffn:htmlNewline cannot be found: cn.itcast.web.common.util.UtilFuns
我的一个Util方法的包名更改了,运行时候报这个错误.找到tld文件,把包名重新改为我改的名字就好使了.
- Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.liuyang.JDbCTemplate.PersonDao]: No default constructor fo
错误是说我的配置文件中没有对构造函数进行配置,所以找不到构造函数,在配置文件application.xml中加入如下句子: <bean id="personDao" clas ...
- HDU 5956 The Elder (树上斜率DP)
题意:给定上一棵树,然后每条边有一个权值,然后每个点到 1 的距离有两种,第一种是直接回到1,花费是 dist(1, i)^2,还有另一种是先到另一个点 j,然后两从 j 向1走,当然 j 也可以再向 ...
- 排列<一>
理论和习题来源于书本,有些能用计算机模拟的题尽量用代码来解. 1.5个球放在3个不同的盒子里面,允许有盒子不放球,求有多少种可能?解:穷举,设盒子A,B,C,每个盒子都有0-5个球的可能,但是三个盒子 ...
- Sensor fusion(传感器融合)
From Wikipedia, the free encyclopedia 来自维基百科,免费的百科Sensor fusion is combining of sensory data or data ...