高精度乘法

2021-08-03 19:57:04 字數 981 閱讀 4537

問題描述

給你兩個正整數a,b,計算它們的乘積。

輸入格式

第一行乙個正整數a

第二行乙個正整數b

輸出格式

一行,表示a*b

樣例輸入

111222333444555666777888999

999888777666555444333222111

樣例輸出

提示

a,b分別不超過100000位

fft裸題。由於是第一道fft所以紀念一下。**總算是背下來了。

注意fft完之後可能出現精度問題和大小超過10的情況,關注處理進製的方法即可。

#include

#include

#include

#include

#define maxn 412345

using

namespace

std;

const

double pi=3.1415926535897932384626433832795;

complex

fft[maxn];

char a[maxn],b[maxn];

complex

a[maxn],b[maxn];

int ans[maxn];

void fft(complex

a,int n,int ty)

高精度減法,高精度乘法

高精度減法 oj資料偏弱如果新增乙個101 2就錯了,下面這一步是為了防止錯誤的 if a aa 0 可能出現第一位的1被借走的的情況,所以加乙個while找第乙個不是0的 while c i 0 i include include include include include include u...

高精度乘法

include include include includeusing namespace std const int maxn 5000 inline int get struct data data operator const data b for int i 1 i c.len i whi...

高精度乘法

高精度乘法1 樸素運算 傳入引數約定 string string 演算法思想 倒置相乘 然後統一處理進製 再還原 演算法複雜度 o n 2 include using namespace std const int l 110 string mul string a,string b for int...