Problem E: Product
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的更多相关文章
- projecteuler---->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 ...
- projecteuler---->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 ...
- Project Euler Problem 8-Largest product in a series
直接暴力 写完才想到,代码写矬了,扫一遍就出结果了,哪还用我写的这么麻烦 ss = '''73167176531330624919225119674426574742355349194934 9698 ...
- UVA11059-Maximum Product(动态规划)
Problem UVA11059-Maximum Product Accept:4769 Submit:38713 Time Limit: 3000 mSec Problem Descriptio ...
- 【转载】Bandits for Recommendation Systems (Part I)
[原文链接:http://engineering.richrelevance.com/bandits-recommendation-systems/.] [本文链接:http://www.cnblog ...
- Contest2073 - 湖南多校对抗赛(2015.04.06)
Contest2073 - 湖南多校对抗赛(2015.04.06) Problem A: (More) Multiplication Time Limit: 1 Sec Memory Limit: ...
- Java 解决一些ACM中大数问题
大数中算术运算结果的首选标度 运算 结果的首选标度 加 max(addend.scale(), augend.scale()) 减 max(minuend.scale(), subtrahend.sc ...
- 1561: (More) Multiplication
Description Educators are always coming up with new ways to teach math to students. In 2011, an educ ...
- 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 = ...
随机推荐
- java.sql.ResultSetMetaData.getColumnLabel和getColumnName的区别
如果将ResultSet的结果映射到HashMap中,要使用getColumnLabel,而不要用getColumnName,这样可提高程序的健壮性 理由: getColumnName返回的是sql语 ...
- NOI2014 Day2
NOI2014 Day2 动物园 题目描述:给出一个字符串(长度为\(Len\)),设\(num[i]\)为字符串的前\(i\)个字符构成的子串(\(A\))中,满足\(A\)的前\(L\)个字符既是 ...
- 基于Qt的图像采集系统
硬件 Point Gray Camera 型号:FL3-U3-13S2C-CS 参数 Sony IMX035 CMOS, 1/3", 3.63 µm Rolling Shutter 1328 ...
- 自定义标签体、MVC
自定义标签 文件以tld结尾,放在webinfo中 标签名 引用类 标签体 继承SimpleTagSupport,复写doTag() getContext(); getjspBody() invo ...
- 从ACM中删除一个已经创建的Library
从ACM中删除一个已经创建的Library,无法通过界面操作,须要手工从DB中删除.须要删除的表记录有: RECENTUPDATE 找到字段Name等于该libraryName的那条记录删除掉 del ...
- POJ 3692 Kindergarten (二分图 最大团)
Kindergarten Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 5660 Accepted: 2756 Desc ...
- eclipse 中修改 M2_REPO的值
转自: http://blog.csdn.net/xuechongyang/article/details/8267440 从eclipse中增加了maven2的插件之后,maven默认的本地库的路径 ...
- Oracle expdp/impdp导出导入命令及数据库备份(转)
使用EXPDP和IMPDP时应该注意的事项: EXP和IMP是客户端工具程序,它们既可以在客户端使用,也可以在服务端使用. EXPDP和IMPDP是服务端的工具程序,他们只能在ORACLE服务端使用, ...
- Gridpanel多种操作帮助文档
1.Ext.grid.GridPanel 主要配置项: store:表格的数据集 columns:表格列模式的配置数组,可自动创建ColumnModel列模式 autoExpandColumn:自动充 ...
- C++学习之文件的输入输出
C++学习之文件的输入输出 一.文件的打开与关闭 1.输出数据到文件 文件的操作需要包含fstream头文件,文件的操作对象为ifstream,ofstrea ...