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分类 流传最广的一种分类: 初期: 一.基本算 ...
随机推荐
- asp.net 中长尾链接实现推送 -- comet
一般需求推送服务时,都会去第三方拿推送组件,如”极光“,”百度“,”小米"什么的,自己用.net实现推送服务端需要面对很多问题,比如C10K,但是企业内部使用往往用不了10K的链接,有个1K ...
- hdu3333 Turing Tree 2016-09-18 20:53 42人阅读 评论(0) 收藏
Turing Tree Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...
- shell 文本处理——使用awk格式化时间戳
date -d @时间戳 "+%Y-%m-%d %H:%M:%S" 也可以内置函数 awk '{print strftime("%Y-%m-%d %H:%M:%S&quo ...
- RelativeLayout中最底的View一个View.layout_marginBottom无效
处理一个Dialog,发现RelativeLayout布局下最后一个View的layout_marginBottom会失效. 效果图见: 解决方法为: 在最底或最右的组件后面再加个View吧... 这 ...
- [jquery-ajax] jquery ajax 三种情况对比
<button class="btn1">async:false</button> <button class="btn2"> ...
- Delphi Dll 动态调用例子(3)-仔细看一下
http://blog.163.com/bxf_0011/blog/static/35420330200952075114318/ Delphi 动态链接库的动态和静态调用 为了让人能快速的理解 静态 ...
- JavaSocket简单通信
以下介绍:简单的socket发送消息,服务的Server 相互 客户端Client,进行简单的传递消息: 服务端代码: package test; import java.io.DataInputSt ...
- 【TypeScript】TypeScript 学习 2——接口
在 TypeScript 中,接口是用作约束作用的,在编译成 JavaScript 的时候,所有的接口都会被擦除掉,因为 JavaScript 中并没有接口这一概念. 先看看一个简单的例子: func ...
- Python学习-24.Python中的算术运算
加法:+,与C#中并无区别,并且一样可以作用于字符串. 但Python中不支持字符串与数值类型的相加. i = 1 s = ' print(s + i) 这样是会在运行时报错的,正确写法如下: i = ...
- wsdl 结构解析
webservice的跨平台特性要求它必须有某种手段来对服务进行自我描述,使不同的语言能正确理解如何调用该服务.webservice通过WSDL(Web Services Description La ...