Problem E: Product
Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 18 Solved: 14
[Submit][Status][Web Board]
Description
The problem is to multiply two integers X, Y. (0<=X,Y<10250)

Input
The input will consist of a set of pairs of lines. Each line in pair contains one multiplyer.

Output
For each input pair of lines the output line should consist one integer the product.

Sample Input
12
12
2
222222222222222222222222
Sample Output
144
444444444444444444444444
my answer:

#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main()
{ char a[];
char b[];
memset(a,'',sizeof(a));
memset(b,'',sizeof(b));
while(cin>>a>>b)
{
int sum[]={};
int t1=strlen(a);
int q=t1;
int t2=strlen(b);
for(int i=t2-;t2>,i>=;i--){
int p=;
for(int j=q-,p=+i-t2+;j>=;t1--){
sum[p--]+=((a[j--]-'')*(b[i]-''));
}
}
for(int k=;k>=;k--){
sum[k-]+=sum[k]/;
sum[k]=sum[k]%;
}
int start=;
while(!sum[start])
start++;
for(int j=start;j<=;j++)
cout<<sum[j];
cout<<endl;
}
return ;
}

Problem E: Product的更多相关文章

  1. projecteuler----&gt;problem=8----Largest product in a series

    title: The four adjacent digits in the 1000-digit number that have the greatest product are 9 9 8 9 ...

  2. projecteuler----&gt;problem=11----Largest product in a grid

    In the 2020 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 1 ...

  3. Project Euler Problem 8-Largest product in a series

    直接暴力 写完才想到,代码写矬了,扫一遍就出结果了,哪还用我写的这么麻烦 ss = '''73167176531330624919225119674426574742355349194934 9698 ...

  4. UVA11059-Maximum Product(动态规划)

    Problem UVA11059-Maximum Product Accept:4769  Submit:38713 Time Limit: 3000 mSec  Problem Descriptio ...

  5. 【转载】Bandits for Recommendation Systems (Part I)

    [原文链接:http://engineering.richrelevance.com/bandits-recommendation-systems/.] [本文链接:http://www.cnblog ...

  6. Contest2073 - 湖南多校对抗赛(2015.04.06)

    Contest2073 - 湖南多校对抗赛(2015.04.06) Problem A: (More) Multiplication Time Limit: 1 Sec  Memory Limit:  ...

  7. Java 解决一些ACM中大数问题

    大数中算术运算结果的首选标度 运算 结果的首选标度 加 max(addend.scale(), augend.scale()) 减 max(minuend.scale(), subtrahend.sc ...

  8. 1561: (More) Multiplication

    Description Educators are always coming up with new ways to teach math to students. In 2011, an educ ...

  9. projecteuler Problem 8 Largest product in a series

    The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = ...

随机推荐

  1. 二道shell面试题

    1.按照给出的运行结果,编写一个名为xunhuan 的shell过程(用循环语句). 0 10 210 3210 43210 543210 6543210 76543210 876543210 2.编 ...

  2. jquery绑定事件,解绑事件

    unbind([type],[data]) 是 bind()的反向操作,从每一个匹配的元素中删除绑定的事件.如果没有参数,则删除所有绑定的事件.你可以将你用bind()注册的自定义事件取消绑定.如果提 ...

  3. APUE读书笔记-第14章-高级I/O

    14.1 引言 *高级I/O包括非阻塞I/O.记录锁.系统V流机制.I/O多路转换(select和poll函数).readv和writev函数以及存储映射I/O(mmap) 14.2 非阻塞I/O * ...

  4. The Swift Programming Language--语言指南--协议

    Protocol(协议)用于统一方法和属性的名称,而不实现任何功能.协议能够被类,枚举,结构体实现,满足协议要求的类,枚举,结构体被称为协议的遵循者.   遵循者需要提供协议指定的成员,如属性,方法, ...

  5. css重置

    清除标签的默认样式 body{margin:0;}ul,ol{margin:0 auto;padding:0;}li{ list-style:none;}dl{margin:0;}dd{margin: ...

  6. 查询离指定日期最近的一条数据(oracle)

    select * from ( Select   *   from   t_currency_rate   where f_orig_curr='USD'   and f_dest_curr='RMB ...

  7. 如何在oracle中导入导出(备份&恢复)dmp数据库文件

    Oracle数据导入导出imp/exp就相当于oracle数据还原与备份.exp命令可以把数据从远程数据库服务器导出到本地的dmp文件,imp命令可以把dmp文件从本地导入到远处的数据库服务器中. 利 ...

  8. Html页面加回滚

    <div class="top-box"> <img src=" class="youlink-img" /><br / ...

  9. Exception in MessageQueue callback: handleReceiveCallback

    07-20 14:27:11.477: E/InputEventReceiver(7209): Exception dispatching input event. 07-20 14:27:11.47 ...

  10. Oracle 数据库导入、导出

    第一步:新建一个txt文件: exp.exe jeamsluu@test file=d:\daochu.dmp log=1.log 另存为.bat格式的文件 第二步:双击运行:此时会弹出输入口令的对话 ...