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

HINT

#include<iostream>
#include<string.h>
using namespace std;
int main()
{
char a[10000],b[10000];
int i,j,t1,c,t2;
while(cin>>a>>b)
{
int sum[10000]={0};
int x=strlen(a);
int y=strlen(b);
t1=9999;t2=9999;
for(i=x-1;i>=0;i--)
{
for(j=y-1;j>=0;j--)
sum[t1--]+=((a[i]-'0')*(b[j]-'0'));
t2--;
t1=t2;
}
c=0;
for(i=9999;i>=0;i--)
{
sum[i]+=c;
c=0;
if(sum[i]>9)
{
c=sum[i]/10;
sum[i]=sum[i]%10;
}
}
for(i=0;i<10000;i++)
{
if(sum[i]!=0)
break;
}
for(j=i;j<10000;j++)
cout<<sum[j];
cout<<endl;
}
return 0;
}

Product( Multiplication of large numbers ) More articles about

  1. UVA 10106 Product ( Multiplication of large numbers )

    Product The Problem The problem is to multiply two integers X, Y. (0<=X,Y<10250) The Input The ...

  2. POJ 2389 Bull Math( water ~Java - Multiplication of large numbers )

    Topic link :http://poj.org/problem?id=2389 The main idea of the topic : Multiplication of large numbers . Their thinking : java BigInteger Class resolution o.0 AC Code: import java.ma ...

  3. Multiplication algorithm of large numbers C++ edition

    #include <iostream> #include <cstring> using namespace std; #define null 0 #define MAXN ...

  4. java Multiplication of large numbers

    Doing ACM I met the problem of multiplication of large numbers when I was young , I found it on the Internet , I saw a c++ Version of http://blog.csdn.net/jianzhibeihang/article/details/4948267 use j ...

  5. Linux C/C++ Practice programming --- Add and multiply large numbers

    Recently, I wrote a program for multiplication and addition of large numbers , It turns out to be right . But the efficiency of the period may not be the best , Some places are also written out temporarily to solve problems . We can talk about the solution of multiplication and addition ( Of course , The operation of large number is basically the operation of two strings ...

  6. Karatsuba Multiplication -- Multiplication of large numbers

    Karatsuba Multiplication Karatsuba Multiplication is a fast multiplication . This algorithm is in 1960 Year by year Anatolii Alexeevitch Karatsuba Put forward , And in 1962 Published in . This algorithm is mainly used to multiply two large numbers ...

  7. leetcode 43 Multiply Strings Multiplication of large numbers

    It seems that the multiplication algorithm of large numbers can best describe . The idea of simulating calculus process class Solution { public String multiply(String num1, String num2) { if(nu ...

  8. Java Multiplication of large numbers 、 Add large numbers 、 Subtracting large numbers

    Source of ideas :: https://blog.csdn.net/lichong_87/article/details/6860329 /** * @date 2018/6/22 * @description ...

  9. Huawei computer test questions ( Multiplication of large numbers -java)

    PS: I didn't write this myself , test OK, For reference . /** * Multiplication of large numbers */ public class BigData { public static void main(String[] args) { ...

  10. solve Catalan Count ,( Multiplication of large numbers , Division of large numbers , Add large numbers )

    Catalan Count Kataran number is a sequence of numbers which often appears in various counting problems in combinatorial mathematics . Take the Belgian mathematician Eugene · Charlie · Cartaran (1814–1894) name . In the history of , Ming Antu, a mathematician in Qing Dynasty (1692 year -1763 year ) In its < Cutting circle ...

Random recommendation

  1. understand Docker(6): Container network solutions in some enterprise production environments

    This series will introduce Docker Knowledge about : (1)Docker Installation and basic usage (2)Docker Mirror image (3)Docker Isolation of containers - Use Linux namespace The operating environment of the isolation container ...

  2. DDD Domain service of domain driven design

    1.DDD How to extract model in domain driven design practice 2.DDD Aggregation of Domain Driven Design . Entity . The value object 3.DDD Domain infrastructure layer of domain driven design What is domain service ,DDD The book says , Some classes or methods , Put entity A Not good either , Put entity B ...

  3. poj 1634

    The question : Here you are. m Employees , and n Second query . Every employee has his own id, income , And height The income of the superior must be greater than that of the subordinate , Height is equal to or greater than that of subordinates . The head of every company has no boss , The boss's number is 0,, At the same time, he has the highest income and height ...

  4. Java Cryptography Extension (JCE): Let go of Java The maximum length of encryption algorithm key 16 The limitation of

    1. Download... On the official website JCE: http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads- ...

  5. Curl And Post Json

    curl Post Json $ curl -i -X POST -H "'Content-type':'application/x-www-form-urlencoded', 'chars ...

  6. listview The picture is misplaced

    Learn from these two articles , Absolutely , Close test effectively ! Abroad coder Of ( need FQ To see ) http://negativeprobability.blogspot.com/2011/08/lazy-loading-of ...

  7. Tomcat The role of each folder under the directory

    1.bin: Store various platforms open and close Tomcat Script file for . 2.lib: save tomcat And web Applied Jar package 3.conf: Deposit tomcat Configuration file for 4.webapps:web The publishing directory of the app , package ...

  8. obtain radio、select、checkbox Tag selected value

    <input type="radio" id="radio1" name="radio"><label for=" ...

  9. Hbase Write load balancing for

    Writing Hbase When , I'm worried about the distribution of data region It's not even on the surface ( It's not about pre partitioning ): The way you might think of at this time :hash. Add salt, etc ( Of course you can , But what to do when reading ? Write an article like this one some day ) This paper adopts a new way ...

  10. Maven Command line creation java or javaWeb project

    Maven Command line creation java or javaWeb project   1. The command line creates normal java project mvn archetype:generate -DgroupId=com.fxust -DartifactId=d ...