#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
bool operator<(vector<int> a,vector<int> b)
{
if(a.size()!=b.size()) return a.size()<b.size();
for(int i=a.size()-1;i>=0;i--)
{
if(a[i]!=b[i]) return a[i]<b[i];
}
return 0;
}
vector<int> operator-(vector<int> a,vector<int> b)
{
vector<int> c;
int t=0;
for(int i=0;i<a.size();i++)
{
t=a[i]-t;
if(i<b.size()) t=t-b[i];
c.push_back((t+10)%10);
if(t<0) t=1;
else t=0;
}
while(c.size()>1&&c.back()==0) c.pop_back();
return c;
}
vector<int> operator/(vector<int> a,vector<int> b)
{
if(a<b) return {0};
int la=a.size(),lb=b.size();
int dv=la-lb;
vector<int> c(dv+10,0);
reverse(b.begin(),b.end());
for(int i=0;i<dv;i++) b.push_back(0);
reverse(b.begin(),b.end());
lb=la;
for(int i=0;i<=dv;i++)
{
while(!(a<b))
{
a=a-b;
c[dv-i]++;
}
b.erase(b.begin());
}
while(c.size()>1&&c.back()==0) c.pop_back();
return c;
}
vector<int> eq(string b)
{
vector<int> a;
for(int i=b.length()-1;i>=0;i--) a.push_back(b[i]-'0');
return a;
}
vector<int> operator+(vector<int> a,vector<int> b)
{
vector<int> c(max(a.size(),b.size())+7);
int t=0;
for(int i=0;i<=max(a.size(),b.size());i++)
{
if(i<a.size()) t+=a[i];
if(i<b.size()) t+=b[i];
c[i]=t%10;
t/=10;
}
while(c.size()>1&&c.back()==0) c.pop_back();
return c;
}
vector<int> to_vector(int n)
{
vector<int> a;
while(n)
{
a.push_back(n%10);
n/=10;
}
return a;
}
int to_int(vector<int> a)
{
int x=0;
for(int i=a.size()-1;i>=0;i--)
{
x*=10;
x+=a[i]%10;
}
return x;
}
vector<int> operator*(vector<int> a,vector<int> b)
{
vector<int> c(a.size()+b.size()+7);
for(int i=0;i<a.size();i++)
{
for(int j=0;j<b.size();j++)
{
c[i+j]+=a[i]*b[j];
}
}
int t=0;
for(int i=0;i<c.size();i++)
{
t+=c[i];
c[i]=t%10;
t/=10;
}
while(c.size()>1&&c.back()==0) c.pop_back();
return c;
}
vector<int> to_ten(string s,int n)
{
vector<int> sum;
sum.push_back(0);
for(int i=s.length()-1;i>=0;i--)
{
int x=s[i]-'0';
if(s[i]>='A'&&s[i]<='Z') x=s[i]-'A'+10;
vector<int> summ;
summ.push_back(1);
vector<int> tmp;
tmp=to_vector(n);
for(int j=1;j<=s.length()-1-i;j++)
{
summ=summ*to_vector(n);
}
tmp=to_vector(x);
sum=sum+summ*to_vector(x);
}
return sum;
}
string to_m(vector<int> x,int m)
{
string y;
while(x.size()>1||x[0]!=0)
{
int t;
if(x<to_vector(m)) t=to_int(x);
else t=to_int(x-x/to_vector(m)*to_vector(m));
if(t>9) t=(t-10)+'A';
else t=t+'0';
y+=t;
x=x/to_vector(m);
}
string ans;
for(int i=y.length()-1;i>=0;i--) ans+=y[i];
return ans;
}
void put(vector<int> a)
{
while(a.size()) cout<<a.back(),a.pop_back();
}
int main()
{
}
标签:return,高精度,int,back,vector,include,size
From: https://www.cnblogs.com/PMpro/p/18375780