---
# System prepended metadata

title: 13519 - Big Integer 2
tags: [class]

---

# 13519 - Big Integer 2
###### tags: `class`
---

## Brief
See the code below

## Solution 0

```cpp=
#include <iostream>
#include "function.h"
using namespace std;

INT INT::operator*(INT n) {
    INT ret;
    int max_len = this->len + n.len;
    int data[maxsize];
    for (int i = 0; i < this->len; i++) {
        for (int j = 0; j < n.len; j++) {
            data[i + j] += this->data[i] * n.data[j];
        }
    }
    for (int i = 0; i < max_len; i++) {
        if (data[i] > 9) {
            data[i + 1] += data[i] / 10;
            data[i] %= 10;
        }
    }
    for (int i = max_len - 1; !data[i]; i--) max_len--;
    ret.len = max_len;
    for (int i = 0; i < max_len; i++) ret.data[i] = data[i];
    return ret;
}

// Utin
```
## Solution 1
``` cpp=
#include "function.h"

INT INT::operator* (INT b) {
    INT re;
    int lena = this->len;
    INT bb = b;
    for (int i = 0; i < lena; i++) {
        for (int j = 0; j < this->data[i]; j++)
            re = re + bb;
        bb.mulby10();
    }
    return re;
}

// TA
```

## Reference