Home BOJ - 2588 - 곱셈
Post
Cancel

BOJ - 2588 - 곱셈

BOJ - 2588 - 곱셈

문제


2588번: 곱셈


슈슉

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<iostream> 
#include<string>
#include<vector>
#include<math.h>

using namespace std;

int main()
{
    string a, b; // 숫자 입력 
    vector<int> temp;
    int tmp;
    int answer=0;
    cin >> a >> b;
    for(int i=0; i <= b.size(); i++)
    {
        tmp = stoi(a) * (int)(b[b.size() - i]-48);
        temp.push_back(tmp);
    }
    for(int i=1; i < temp.size(); i++)
    {
        cout << temp[i] << endl;
        temp[i] *= pow(10, (i-1));
    }
    for(int i=1; i < temp.size(); i++)
        answer += temp[i];
    cout << answer << endl;  
}
This post is licensed under CC BY 4.0 by the author.