为什么高精加就60分

P1001 A+B Problem

wu_wowo @ 2020-10-06 12:22:06


#include <iostream>
#include <cstring> 
using namespace std;
char a[1001],b[1001];
int a1[1001],b1[1001],c[1001];
int main(){
    cin >> a >> b;
    int lena = strlen(a);
    int lenb = strlen(b);
    int lenc = lena>lenb?lena:lenb; 
    for(int i=0;i<lena;i++){
        a1[i]=a[lena-1-i]-48;
    }
    for(int i=0;i<lenb;i++){
        b1[i]=b[lenb-1-i]-48;
    }
    int x=0;
    for(int i=0;i<lenc;i++){
        c[i]=a1[i]+b1[i]+x;
        x=c[i]/10;
        c[i]%=10;
    }
    if(x){
        c[lenc]=x;
    }else{
        lenc--;
    }
    for(int i=lenc;i>=0;i--){
        cout<<c[i];
    } 
    return 0;
}

by Blood_red @ 2021-03-14 14:23:39

#include<bits/stdc++.h>
using namespace std;
char a[205],b[205];
int sa[205],sb[205];
int s[205];
int main(){
    cin>>a>>b;
    int la=strlen(a);
    int lb=strlen(b);
    int ls=max(la,lb);
    for(int i=0;i<la;i++)sa[la-i]=a[i]-'0';
    for(int i=0;i<lb;i++)sb[lb-i]=b[i]-'0';
    for(int i=1;i<=ls;i++)s[i]=sa[i]+sb[i];
    for(int i=1;i<=ls;i++){
        s[i+1]=s[i+1]+s[i]/10;
        s[i]=s[i]%10;
    }
    while(s[ls]==0&&ls>1){
        ls--;
    }
    if(s[ls+1])ls++;
    for(int i=ls;i>=1;i--){
        cout<<s[i];
    }
}

60.。。。。。


by __Luna__ @ 2022-12-21 09:29:52

高精你该这么写:

#include<iostream>
#include<cmath>
#include<string>
using namespace std;
class very_long
{
    bool sign;
    int len;
    short* value;
public:
    very_long()
    {
        sign = 1;
        value = new short[13];
        len = 13;
        value[12] = 1;
        value[11] = 1;
        value[10] = 4;
        value[9] = 5;
        value[8] = 1;
        value[7] = 4;
        value[6] = 1;
        value[5] = 9;
        value[4] = 1;
        value[3] = 9;
        value[2] = 8;
        value[1] = 1;
        value[0] = 0;
    }
    very_long(const very_long& a)
    {
        sign = a.sign;
        len = a.len;
        if (len <= 0)value = { 0 };
        else {
            value = new short[len];
            for (int i = 0; i != len; i++)
            {
                value[i] = a.value[i];
            }
        }
    }
    very_long(string a)
    {
        string b = a;
        if (b.find(".") != -1)
            b = b.substr(0, b.find("."));
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        if (b == string("inf") || b == string("Inf") || b == string("infinity") || b == string("Infinity"))
        {
            len = -1;
            value = { 0 };
            return;
        }
        if (b == string("nan") || b == string("NaN"))
        {
            len = -2;
            value = { 0 };
            return;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(const char a[])
    {
        string b = a;
        if (b.find(".") != -1)
            b = b.substr(0, b.find("."));
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        if (b == string("inf") || b == string("Inf") || b == string("infinity") || b == string("Infinity"))
        {
            len = -1;
            value = { 0 };
            return;
        }
        if (b == string("nan") || b == string("NaN"))
        {
            len = -2;
            value = { 0 };
            return;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(unsigned int a)
    {
        string b = to_string(a);
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(unsigned long a)
    {
        string b = to_string(a);
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(unsigned long long a)
    {
        string b = to_string(a);
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(unsigned short a)
    {
        string b = to_string(a);
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(bool a)
    {
        string b = to_string(a);
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(int a)
    {
        string b = to_string(a);
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(long a)
    {
        string b = to_string(a);
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(long long a)
    {
        string b = to_string(a);
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(char a)
    {
        string b = to_string(int(a));
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(unsigned char a)
    {
        string b = to_string(int(a));
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(short a)
    {
        string b = to_string(a);
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(float a)
    {
        double ccc = 1.0, ddd = 0.0;
        if (double(a) == double(ccc / ddd))
        {
            sign = 1;
            len = -1;
            value = { 0 };
            return;
        }
        else if (double(a) == double(-(ccc / ddd)))
        {
            sign = 0;
            len = -1;
            value = { 0 };
            return;
        }
        if (double(a) == double(ddd / ddd))
        {
            sign = 1;
            len = -2;
            value = { 0 };
            return;
        }
        else if (double(a) == double(-(ddd / ddd)))
        {
            sign = 0;
            len = -2;
            value = { 0 };
            return;
        }
        string b = to_string(a);
        if (b.find(".") != -1)
            b = b.substr(0, b.find("."));
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(double a)
    {
        double ccc = 1.0, ddd = 0.0;
        if (double(a) == double(ccc / ddd))
        {
            sign = 1;
            len = -1;
            value = { 0 };
            return;
        }
        else if (double(a) == double(-(ccc / ddd)))
        {
            sign = 0;
            len = -1;
            value = { 0 };
            return;
        }
        if (double(a) == double(ddd / ddd))
        {
            sign = 1;
            len = -2;
            value = { 0 };
            return;
        }
        else if (double(a) == double(-(ddd / ddd)))
        {
            sign = 0;
            len = -2;
            value = { 0 };
            return;
        }
        string b = to_string(a);
        if (b.find(".") != -1)
            b = b.substr(0, b.find("."));
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long(long double a)
    {
        double ccc = 1.0, ddd = 0.0;
        if (double(a) == double(ccc / ddd))
        {
            sign = 1;
            len = -1;
            value = { 0 };
            return;
        }
        else if (double(a) == double(-(ccc / ddd)))
        {
            sign = 0;
            len = -1;
            value = { 0 };
            return;
        }
        if (double(a) == double(ddd / ddd))
        {
            sign = 1;
            len = -2;
            value = { 0 };
            return;
        }
        else if (double(a) == double(-(ddd / ddd)))
        {
            sign = 0;
            len = -2;
            value = { 0 };
            return;
        }
        string b = to_string(a);
        if (b.find(".") != -1)
            b = b.substr(0, b.find("."));
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            sign = 0;
        }
        else
        {
            sign = 1;
        }
        len = b.size();
        value = new short[b.size()];
        for (int i = 0; i != len; i++)
        {
            value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
    }
    very_long& operator = (very_long a)
    {
        sign = a.sign;
        len = a.len;
        delete[]value;
        if (len <= 0)value = { 0 };
        else
        {
            value = new short[len];
            for (int i = 0; i != len; i++)
            {
                value[i] = a.value[i];
            }
        }
        return *this;
    }
    friend istream& operator>>(istream& in, very_long& a)
    {
        string b;
        in >> b;
        if (b.find(".") != -1)
            b = b.substr(0, b.find("."));
        if (b.substr(0, 1) == "-")
        {
            b = b.substr(1, b.size() - 1);
            a.sign = 0;
        }
        else
        {
            a.sign = 1;
        }
        if (b == string("inf") || b == string("Inf") || b == string("infinity") || b == string("Infinity"))
        {
            a.len = -1;
            a.value = { 0 };
            return in;
        }
        if (b == string("nan") || b == string("NaN"))
        {
            a.len = -2;
            a.value = { 0 };
            return in;
        }
        a.len = b.size();
        delete[]a.value;
        a.value = new short[b.size()];
        for (int i = 0; i != a.len; i++)
        {
            a.value[i] = short(b.substr(b.size() - 1, 1).c_str()[0] - '0');
            b = b.substr(0, b.size() - 1);
        }
        return in;
    }
    friend ostream& operator<<(ostream& out, const very_long& a)
    {
        if (a.len == -2)
        {
            out << "nan";
            return out;
        }
        out << ((a.sign == 0) ? "-" : "");
        if (a.len == -1)
        {
            out << "inf";
            return out;
        }
        for (int i = a.len - 1; i != -1; i--)
        {
            out << a.value[i];
        }
        return out;
    }
    ~very_long()
    {
        delete[]value;
    }
    operator const char* () const
    {
        string b;
        const char* a;
        if (len == -2)
        {
            b += "nan";
            a = b.c_str();
            return a;
        }
        b += ((sign == 0) ? "-" : "");
        if (len == -1)
        {
            b += "inf";
            a = b.c_str();
            return a;
        }
        for (int i = len - 1; i != -1; i--)
        {
            b += '0' + char(value[i]);
        }
        a = b.c_str();
        return a;
    }
    friend string to_string(very_long a)
    {
        string b;
        if (a.len == -2)
        {
            b += "nan";
            return b;
        }

        b += ((a.sign == 0) ? "-" : "");
        if (a.len == -1)
        {
            b += "inf";
            return b;
        }
        for (int i = a.len - 1; i != -1; i--)
        {
            b += '0' + char(a.value[i]);
        }
        return b;
    }
    operator char* () const
    {
        string b;
        if (len == -2)
        {
            b += "nan";
            char* a = new char[b.size() + 1];
            for (int i = 0; i != b.size() + 1; i++)
                a[i] = b.c_str()[i];
            return a;
        }
        b += ((sign == 0) ? "-" : "");
        if (len == -1)
        {
            b += "inf";
            char* a = new char[b.size() + 1];
            for (int i = 0; i != b.size() + 1; i++)
                a[i] = b.c_str()[i];
            return a;
        }
        for (int i = len - 1; i != -1; i--)
        {
            b += '0' + char(value[i]);
        }
        char* a = new char[b.size() + 1];
        for (int i = 0; i != b.size() + 1; i++)
            a[i] = b.c_str()[i];
        return a;
    }
    friend very_long operator +(const very_long& a, const very_long& b)
    {
        very_long c;
        if (a.len == -2)
        {
            return a;
        }
        if (b.len == -2)
        {
            return b;
        }
        if (a.len == -1 && b.len == -1 && a.sign != b.sign)
        {
            return very_long("nan");
        }
        if (a.len == -1)
        {
            return a;
        }
        if (b.len == -1)
        {
            return b;
        }
        if (a.sign == b.sign)
        {
            c.sign = a.sign;
            c.len = a.len > b.len ? a.len + 1 : b.len + 1;
            delete[]c.value;
            c.value = new short[c.len];
            int o = 0;
            for (int i = 0; i != c.len; i++)
            {
                c.value[i] = ((i >= a.len ? 0 : a.value[i]) + (i >= b.len ? 0 : b.value[i]) + o) % 10;
                o = ((i >= a.len ? 0 : a.value[i]) + (i >= b.len ? 0 : b.value[i]) + o) / 10;
            }
        }
        else
        {
            very_long aa, bb;
            aa = a;
            bb = b;
            if (a.len < b.len)
            {
                aa = b;
                bb = a;
            }
            else if (a.len == b.len)
            {
                for (int i = a.len - 1; i != -1; i--)
                {
                    if (a.value[i] < b.value[i])
                    {
                        aa = b;
                        bb = a;
                        break;
                    }
                    if (a.value[i] > b.value[i])
                    {
                        break;
                    }
                }
            }
            c = aa;
            int o = 0;
            for (int i = 0; i != c.len; i++)
            {
                c.value[i] -= (i >= bb.len ? 0 : bb.value[i]) + o;
                o = 0;
                if (c.value[i] < 0)
                {
                    c.value[i] += 10;
                    o = 1;
                }
            }
        }
        while (c.value[c.len - 1] == 0 && c.len != 1)
        {
            c.len = c.len - 1;
        }
        if (c.len == 1 && c.value[0] == 0)
        {
            c.sign = 1;
        }
        return c;
    }
    friend very_long operator +(const very_long& a, const int& b)
    {
        return a + very_long(b);
    }
    friend very_long operator +(const int& a, const very_long& b)
    {
        return very_long(a) + b;
    }
    friend very_long operator +(const very_long& a, const bool& b)
    {
        return a + very_long(b);
    }
    friend very_long operator +(const bool& a, const very_long& b)
    {
        return very_long(a) + b;
    }
    friend very_long operator +(const very_long& a, const long& b)
    {
        return a + very_long(b);
    }
    friend very_long operator +(const long& a, const very_long& b)
    {
        return very_long(a) + b;
    }
    friend very_long operator +(const very_long& a, const long long& b)
    {
        return a + very_long(b);
    }
    friend very_long operator +(const long long& a, const very_long& b)
    {
        return very_long(a) + b;
    }
    friend very_long operator +(const very_long& a, const short& b)
    {
        return a + very_long(b);
    }
    friend very_long operator +(const short& a, const very_long& b)
    {
        return very_long(a) + b;
    }
    friend very_long operator +(const very_long& a, const unsigned int& b)
    {
        return a + very_long(b);
    }
    friend very_long operator +(const unsigned int& a, const very_long& b)
    {
        return very_long(a) + b;
    }
    friend very_long operator +(const very_long& a, const unsigned long& b)
    {
        return a + very_long(b);
    }
    friend very_long operator +(const unsigned long& a, const very_long& b)
    {
        return very_long(a) + b;
    }
    friend very_long operator +(const very_long& a, const unsigned long long& b)
    {
        return a + very_long(b);
    }
    friend very_long operator +(const unsigned long long& a, const very_long& b)
    {
        return very_long(a) + b;
    }
    friend very_long operator +(const very_long& a, const unsigned short& b)
    {
        return a + very_long(b);
    }
    friend very_long operator +(const unsigned short& a, const very_long& b)
    {
        return very_long(a) + b;
    }
    friend very_long operator +(const very_long& a, const unsigned char& b)
    {
        return a + very_long(b);
    }
    friend very_long operator +(const unsigned char& a, const very_long& b)
    {
        return very_long(a) + b;
    }
    friend very_long operator +(const very_long& a, const char& b)
    {
        return a + very_long(b);
    }
    friend very_long operator +(const char& a, const very_long& b)
    {
        return very_long(a) + b;
    }
    friend very_long operator +(const very_long& a, const char b[])
    {
        string bb = b;
        return a + very_long(bb);
    }
    friend very_long operator +(const char a[], const very_long& b)
    {
        string aa = a;
        return very_long(aa) + b;
    }
    friend very_long operator +(const very_long& a, const string& b)
    {
        return a + very_long(b);
    }
    friend very_long operator +(const string& a, const very_long& b)
    {
        return very_long(a) + b;
    }
    friend very_long operator- (const very_long& a)
    {
        very_long b = a;
        b.sign = (b.sign + 1) % 2;
        return b;
    }
    friend very_long operator -(const very_long& a, const very_long& b)
    {
        very_long aa = a, bb = b;
        return aa + (-bb);
    }
    friend very_long operator -(const very_long& a, const int& b)
    {
        return a - very_long(b);
    }
    friend very_long operator -(const int& a, const very_long& b)
    {
        return very_long(a) - b;
    }
    friend very_long operator -(const very_long& a, const bool& b)
    {
        return a - very_long(b);
    }
    friend very_long operator -(const bool& a, const very_long& b)
    {
        return very_long(a) - b;
    }
    friend very_long operator -(const very_long& a, const long& b)
    {
        return a - very_long(b);
    }
    friend very_long operator -(const long& a, const very_long& b)
    {
        return very_long(a) - b;
    }
    friend very_long operator -(const very_long& a, const long long& b)
    {
        return a - very_long(b);
    }
    friend very_long operator -(const long long& a, const very_long& b)
    {
        return very_long(a) - b;
    }
    friend very_long operator -(const very_long& a, const short& b)
    {
        return a - very_long(b);
    }
    friend very_long operator -(const short& a, const very_long& b)
    {
        return very_long(a) - b;
    }
    friend very_long operator -(const very_long& a, const unsigned int& b)
    {
        return a - very_long(b);
    }
    friend very_long operator -(const unsigned int& a, const very_long& b)
    {
        return very_long(a) - b;
    }
    friend very_long operator -(const very_long& a, const unsigned long& b)
    {
        return a - very_long(b);
    }
    friend very_long operator -(const unsigned long& a, const very_long& b)
    {
        return very_long(a) - b;
    }
    friend very_long operator -(const very_long& a, const unsigned long long& b)
    {
        return a - very_long(b);
    }
    friend very_long operator -(const unsigned long long& a, const very_long& b)
    {
        return very_long(a) - b;
    }
    friend very_long operator -(const very_long& a, const unsigned short& b)
    {
        return a - very_long(b);
    }
    friend very_long operator -(const unsigned short& a, const very_long& b)
    {
        return very_long(a) - b;
    }
    friend very_long operator -(const very_long& a, const unsigned char& b)
    {
        return a - very_long(b);
    }
    friend very_long operator -(const unsigned char& a, const very_long& b)
    {
        return very_long(a) - b;
    }
    friend very_long operator -(const very_long& a, const char& b)
    {
        return a - very_long(b);
    }
    friend very_long operator -(const char& a, const very_long& b)
    {
        return very_long(a) - b;
    }
    friend very_long operator -(const very_long& a, const char b[])
    {
        string bb = b;
        return a - very_long(bb);
    }
    friend very_long operator -(const char a[], const very_long& b)
    {
        string aa = a;
        return very_long(aa) - b;
    }
    friend very_long operator -(const very_long& a, const string& b)
    {
        return a - very_long(b);
    }
    friend very_long operator -(const string& a, const very_long& b)
    {
        return very_long(a) - b;
    }
    friend bool operator >(const very_long& a, const very_long& b)
    {
        if (a.len == -2)
        {
            return false;
        }
        if (b.len == -2)
        {
            return false;
        }
        if (a.len == -1 && b.len == -1 && a.sign == b.sign)
            return false;
        if (a.len == -1)
        {
            if (a.sign == 1)
                return true;
            else
                return false;
        }
        if (b.len == -1)
        {
            if (b.sign == 0)
                return true;
            else
                return false;
        }
        if (a.sign == 0 && b.sign == 1)
            return false;
        if (a.sign == 1 && b.sign == 0)
            return true;
        if (a.sign == 0 && b.sign == 0)
        {
            very_long aa = a, bb = b;
            return (-aa) < (-bb);
        }
        if (a.len > b.len)
        {
            return true;
        }
        else if (a.len == b.len)
        {
            for (int i = a.len - 1; i != -1; i--)
            {
                if (a.value[i] > b.value[i])
                {
                    return true;
                }
                if (a.value[i] < b.value[i])
                {
                    return false;
                }
            }
        }
        return false;
    }
    friend bool operator >(const very_long& a, const int& b)
    {
        return a > very_long(b);
    }
    friend bool operator >(const int& a, const very_long& b)
    {
        return very_long(a) > b;
    }
    friend bool operator >(const very_long& a, const bool& b)
    {
        return a > very_long(b);
    }
    friend bool operator >(const bool& a, const very_long& b)
    {
        return very_long(a) > b;
    }
    friend bool operator >(const very_long& a, const long& b)
    {
        return a > very_long(b);
    }
    friend bool operator >(const long& a, const very_long& b)
    {
        return very_long(a) > b;
    }
    friend bool operator >(const very_long& a, const long long& b)
    {
        return a > very_long(b);
    }
    friend bool operator >(const long long& a, const very_long& b)
    {
        return very_long(a) > b;
    }
    friend bool operator >(const very_long& a, const short& b)
    {
        return a > very_long(b);
    }
    friend bool operator >(const short& a, const very_long& b)
    {
        return very_long(a) > b;
    }
    friend bool operator >(const very_long& a, const unsigned int& b)
    {
        return a > very_long(b);
    }
    friend bool operator >(const unsigned int& a, const very_long& b)
    {
        return very_long(a) > b;
    }
    friend bool operator >(const very_long& a, const unsigned long& b)
    {
        return a > very_long(b);
    }
    friend bool operator >(const unsigned long& a, const very_long& b)
    {
        return very_long(a) > b;
    }
    friend bool operator >(const very_long& a, const unsigned long long& b)
    {
        return a > very_long(b);
    }
    friend bool operator >(const unsigned long long& a, const very_long& b)
    {
        return very_long(a) > b;
    }
    friend bool operator >(const very_long& a, const unsigned short& b)
    {
        return a > very_long(b);
    }
    friend bool operator >(const unsigned short& a, const very_long& b)
    {
        return very_long(a) > b;
    }
    friend bool operator >(const very_long& a, const unsigned char& b)
    {
        return a > very_long(b);
    }
    friend bool operator >(const unsigned char& a, const very_long& b)
    {
        return very_long(a) > b;
    }
    friend bool operator >(const very_long& a, const char& b)
    {
        return a > very_long(b);
    }
    friend bool operator >(const char& a, const very_long& b)
    {
        return very_long(a) > b;
    }
    friend bool operator >(const very_long& a, const char b[])
    {
        string bb = b;
        return a > very_long(bb);
    }
    friend bool operator >(const char a[], const very_long& b)
    {
        string aa = a;
        return very_long(aa) > b;
    }
    friend bool operator >(const very_long& a, const string& b)
    {
        return a > very_long(b);
    }
    friend bool operator >(const string& a, const very_long& b)
    {
        return very_long(a) > b;
    }
    friend bool operator <(const very_long& a, const very_long& b)
    {
        if (a.len == -2)
        {
            return false;
        }
        if (b.len == -2)
        {
            return false;
        }
        if (a.len == -1 && b.len == -1 && a.sign == b.sign)
            return false;
        if (a.len == -1)
        {
            if (a.sign == 0)
                return true;
            else
                return false;
        }
        if (b.len == -1)
        {
            if (b.sign == 1)
                return true;
            else
                return false;
        }
        if (a.sign == 0 && b.sign == 1)
            return true;
        if (a.sign == 1 && b.sign == 0)
            return false;
        if (a.sign == 0 && b.sign == 0)
        {
            very_long aa = a, bb = b;
            return (-aa) > (-bb);
        }
        if (a.len < b.len)
        {
            return true;
        }
        else if (a.len == b.len)
        {
            for (int i = a.len - 1; i != -1; i--)
            {
                if (a.value[i] < b.value[i])
                {
                    return true;
                }
                if (a.value[i] > b.value[i])
                {
                    return false;
                }
            }
        }
        return false;
    }
    friend bool operator <(const very_long& a, const int& b)
    {
        return a < very_long(b);
    }
    friend bool operator <(const int& a, const very_long& b)
    {
        return very_long(a) < b;
    }
    friend bool operator <(const very_long& a, const bool& b)
    {
        return a < very_long(b);
    }
    friend bool operator <(const bool& a, const very_long& b)
    {
        return very_long(a) < b;
    }
    friend bool operator <(const very_long& a, const long& b)
    {
        return a < very_long(b);
    }
    friend bool operator <(const long& a, const very_long& b)
    {
        return very_long(a) < b;
    }
    friend bool operator <(const very_long& a, const long long& b)
    {
        return a < very_long(b);
    }
    friend bool operator <(const long long& a, const very_long& b)
    {
        return very_long(a) < b;
    }
    friend bool operator <(const very_long& a, const short& b)
    {
        return a < very_long(b);
    }
    friend bool operator <(const short& a, const very_long& b)
    {
        return very_long(a) < b;
    }
    friend bool operator <(const very_long& a, const unsigned int& b)
    {
        return a < very_long(b);
    }
    friend bool operator <(const unsigned int& a, const very_long& b)
    {
        return very_long(a) < b;
    }
    friend bool operator <(const very_long& a, const unsigned long& b)
    {
        return a < very_long(b);
    }
    friend bool operator <(const unsigned long& a, const very_long& b)
    {
        return very_long(a) < b;
    }
    friend bool operator <(const very_long& a, const unsigned long long& b)
    {
        return a < very_long(b);
    }
    friend bool operator <(const unsigned long long& a, const very_long& b)
    {
        return very_long(a) < b;
    }
    friend bool operator <(const very_long& a, const unsigned short& b)
    {
        return a < very_long(b);
    }
    friend bool operator <(const unsigned short& a, const very_long& b)
    {
        return very_long(a) < b;
    }
    friend bool operator <(const very_long& a, const unsigned char& b)
    {
        return a < very_long(b);
    }
    friend bool operator <(const unsigned char& a, const very_long& b)
    {
        return very_long(a) < b;
    }
    friend bool operator <(const very_long& a, const char& b)
    {
        return a < very_long(b);
    }
    friend bool operator <(const char& a, const very_long& b)
    {
        return very_long(a) < b;
    }
    friend bool operator <(const very_long& a, const char b[])
    {
        string bb = b;
        return a < very_long(bb);
    }
    friend bool operator <(const char a[], const very_long& b)
    {
        string aa = a;
        return very_long(aa) < b;
    }
    friend bool operator <(const very_long& a, const string& b)
    {
        return a < very_long(b);
    }
    friend bool operator <(const string& a, const very_long& b)
    {
        return very_long(a) < b;
    }
    friend bool operator ==(const very_long& a, const very_long& b)
    {
        if (a.len == -2)
        {
            return false;
        }
        if (b.len == -2)
        {
            return false;
        }
        if (a<b || a>b)
        {
            return false;
        }
        else
        {
            return true;
        }
    }
    friend bool operator ==(const very_long& a, const int& b)
    {
        return a == very_long(b);
    }
    friend bool operator ==(const int& a, const very_long& b)
    {
        return very_long(a) == b;
    }
    friend bool operator ==(const very_long& a, const bool& b)
    {
        return a == very_long(b);
    }
    friend bool operator ==(const bool& a, const very_long& b)
    {
        return very_long(a) == b;
    }
    friend bool operator ==(const very_long& a, const long& b)
    {
        return a == very_long(b);
    }
    friend bool operator ==(const long& a, const very_long& b)
    {
        return very_long(a) == b;
    }
    friend bool operator ==(const very_long& a, const long long& b)
    {
        return a == very_long(b);
    }
    friend bool operator ==(const long long& a, const very_long& b)
    {
        return very_long(a) == b;
    }
    friend bool operator ==(const very_long& a, const short& b)
    {
        return a == very_long(b);
    }
    friend bool operator ==(const short& a, const very_long& b)
    {
        return very_long(a) == b;
    }
    friend bool operator ==(const very_long& a, const unsigned int& b)
    {
        return a == very_long(b);
    }
    friend bool operator ==(const unsigned int& a, const very_long& b)
    {
        return very_long(a) == b;
    }
    friend bool operator ==(const very_long& a, const unsigned long& b)
    {
        return a == very_long(b);
    }
    friend bool operator ==(const unsigned long& a, const very_long& b)
    {
        return very_long(a) == b;
    }
    friend bool operator ==(const very_long& a, const unsigned long long& b)
    {
        return a == very_long(b);
    }
    friend bool operator ==(const unsigned long long& a, const very_long& b)
    {
        return very_long(a) == b;
    }
    friend bool operator ==(const very_long& a, const unsigned short& b)
    {
        return a == very_long(b);
    }
    friend bool operator ==(const unsigned short& a, const very_long& b)
    {
        return very_long(a) == b;
    }
    friend bool operator ==(const very_long& a, const unsigned char& b)
    {
        return a == very_long(b);
    }
    friend bool operator ==(const unsigned char& a, const very_long& b)
    {
        return very_long(a) == b;
    }
    friend bool operator ==(const very_long& a, const char& b)
    {
        return a == very_long(b);
    }
    friend bool operator ==(const char& a, const very_long& b)
    {
        return very_long(a) == b;
    }
    friend bool operator ==(const very_long& a, const char b[])
    {
        string bb = b;
        return a == very_long(bb);
    }
    friend bool operator ==(const char a[], const very_long& b)
    {
        string aa = a;
        return very_long(aa) == b;
    }
    friend bool operator ==(const very_long& a, const string& b)
    {
        return a == very_long(b);
    }
    friend bool operator ==(const string& a, const very_long& b)
    {
        return very_long(a) == b;
    }
    friend bool operator !=(const very_long& a, const very_long& b)
    {
        if (a.len == -2)
        {
            return true;
        }
        if (b.len == -2)
        {
            return true;
        }
        if (a<b || a>b)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    friend bool operator !=(const very_long& a, const int& b)
    {
        return a != very_long(b);
    }
    friend bool operator !=(const int& a, const very_long& b)
    {
        return very_long(a) != b;
    }
    friend bool operator !=(const very_long& a, const bool& b)
    {
        return a != very_long(b);
    }
    friend bool operator !=(const bool& a, const very_long& b)
    {
        return very_long(a) != b;
    }
    friend bool operator !=(const very_long& a, const long& b)
    {
        return a != very_long(b);
    }
    friend bool operator !=(const long& a, const very_long& b)
    {
        return very_long(a) != b;
    }
    friend bool operator !=(const very_long& a, const long long& b)
    {
        return a != very_long(b);
    }
    friend bool operator !=(const long long& a, const very_long& b)
    {
        return very_long(a) != b;
    }
    friend bool operator !=(const very_long& a, const short& b)
    {
        return a != very_long(b);
    }
    friend bool operator !=(const short& a, const very_long& b)
    {
        return very_long(a) != b;
    }
    friend bool operator !=(const very_long& a, const unsigned int& b)
    {
        return a != very_long(b);
    }
    friend bool operator !=(const unsigned int& a, const very_long& b)
    {
        return very_long(a) != b;
    }
    friend bool operator !=(const very_long& a, const unsigned long& b)
    {
        return a != very_long(b);
    }
    friend bool operator !=(const unsigned long& a, const very_long& b)
    {
        return very_long(a) != b;
    }
    friend bool operator !=(const very_long& a, const unsigned long long& b)
    {
        return a != very_long(b);
    }
    friend bool operator !=(const unsigned long long& a, const very_long& b)
    {
        return very_long(a) != b;
    }
    friend bool operator !=(const very_long& a, const unsigned short& b)
    {
        return a != very_long(b);
    }
    friend bool operator !=(const unsigned short& a, const very_long& b)
    {
        return very_long(a) != b;
    }
    friend bool operator !=(const very_long& a, const unsigned char& b)
    {
        return a != very_long(b);
    }
    friend bool operator !=(const unsigned char& a, const very_long& b)
    {
        return very_long(a) != b;
    }
    friend bool operator !=(const very_long& a, const char& b)
    {
        return a != very_long(b);
    }
    friend bool operator !=(const char& a, const very_long& b)
    {
        return very_long(a) != b;
    }
    friend bool operator !=(const very_long& a, const char b[])
    {
        string bb = b;
        return a != very_long(bb);
    }
    friend bool operator !=(const char a[], const very_long& b)
    {
        string aa = a;
        return very_long(aa) != b;
    }
    friend bool operator !=(const very_long& a, const string& b)
    {
        return a != very_long(b);
    }
    friend bool operator !=(const string& a, const very_long& b)
    {
        return very_long(a) != b;
    }
    friend bool operator <=(const very_long& a, const very_long& b)
    {
        if (a < b || a == b)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    friend bool operator <=(const very_long& a, const int& b)
    {
        return a <= very_long(b);
    }
    friend bool operator <=(const int& a, const very_long& b)
    {
        return very_long(a) <= b;
    }
    friend bool operator <=(const very_long& a, const bool& b)
    {
        return a <= very_long(b);
    }
    friend bool operator <=(const bool& a, const very_long& b)
    {
        return very_long(a) <= b;
    }
    friend bool operator <=(const very_long& a, const long& b)
    {
        return a <= very_long(b);
    }
    friend bool operator <=(const long& a, const very_long& b)
    {
        return very_long(a) <= b;
    }
    friend bool operator <=(const very_long& a, const long long& b)
    {
        return a <= very_long(b);
    }
    friend bool operator <=(const long long& a, const very_long& b)
    {
        return very_long(a) <= b;
    }
    friend bool operator <=(const very_long& a, const short& b)
    {
        return a <= very_long(b);
    }
    friend bool operator <=(const short& a, const very_long& b)
    {
        return very_long(a) <= b;
    }
    friend bool operator <=(const very_long& a, const unsigned int& b)
    {
        return a <= very_long(b);
    }
    friend bool operator <=(const unsigned int& a, const very_long& b)
    {
        return very_long(a) <= b;
    }
    friend bool operator <=(const very_long& a, const unsigned long& b)
    {
        return a <= very_long(b);
    }
    friend bool operator <=(const unsigned long& a, const very_long& b)
    {
        return very_long(a) <= b;
    }
    friend bool operator <=(const very_long& a, const unsigned long long& b)
    {
        return a <= very_long(b);
    }
    friend bool operator <=(const unsigned long long& a, const very_long& b)
    {
        return very_long(a) <= b;
    }
    friend bool operator <=(const very_long& a, const unsigned short& b)
    {
        return a <= very_long(b);
    }
    friend bool operator <=(const unsigned short& a, const very_long& b)
    {
        return very_long(a) <= b;
    }
    friend bool operator <=(const very_long& a, const unsigned char& b)
    {
        return a <= very_long(b);
    }
    friend bool operator <=(const unsigned char& a, const very_long& b)
    {
        return very_long(a) <= b;
    }
    friend bool operator <=(const very_long& a, const char& b)
    {
        return a <= very_long(b);
    }
    friend bool operator <=(const char& a, const very_long& b)
    {
        return very_long(a) <= b;
    }
    friend bool operator <=(const very_long& a, const char b[])
    {
        string bb = b;
        return a <= very_long(bb);
    }
    friend bool operator <=(const char a[], const very_long& b)
    {
        string aa = a;
        return very_long(aa) <= b;
    }
    friend bool operator <=(const very_long& a, const string& b)
    {
        return a <= very_long(b);
    }
    friend bool operator <=(const string& a, const very_long& b)
    {
        return very_long(a) <= b;
    }
    friend bool operator >=(const very_long& a, const very_long& b)
    {
        if (a > b || a == b)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    friend bool operator >=(const very_long& a, const int& b)
    {
        return a >= very_long(b);
    }
    friend bool operator >=(const int& a, const very_long& b)
    {
        return very_long(a) >= b;
    }
    friend bool operator >=(const very_long& a, const bool& b)
    {
        return a >= very_long(b);
    }
    friend bool operator >=(const bool& a, const very_long& b)
    {
        return very_long(a) >= b;
    }
    friend bool operator >=(const very_long& a, const long& b)
    {
        return a >= very_long(b);
    }
    friend bool operator >=(const long& a, const very_long& b)
    {
        return very_long(a) >= b;
    }
    friend bool operator >=(const very_long& a, const long long& b)
    {
        return a >= very_long(b);
    }
    friend bool operator >=(const long long& a, const very_long& b)
    {
        return very_long(a) >= b;
    }
    friend bool operator >=(const very_long& a, const short& b)
    {
        return a >= very_long(b);
    }
    friend bool operator >=(const short& a, const very_long& b)
    {
        return very_long(a) >= b;
    }
    friend bool operator >=(const very_long& a, const unsigned int& b)
    {
        return a >= very_long(b);
    }
    friend bool operator >=(const unsigned int& a, const very_long& b)
    {
        return very_long(a) >= b;
    }
    friend bool operator >=(const very_long& a, const unsigned long& b)
    {
        return a >= very_long(b);
    }
    friend bool operator >=(const unsigned long& a, const very_long& b)
    {
        return very_long(a) >= b;
    }
    friend bool operator >=(const very_long& a, const unsigned long long& b)
    {
        return a >= very_long(b);
    }
    friend bool operator >=(const unsigned long long& a, const very_long& b)
    {
        return very_long(a) >= b;
    }
    friend bool operator >=(const very_long& a, const unsigned short& b)
    {
        return a >= very_long(b);
    }
    friend bool operator >=(const unsigned short& a, const very_long& b)
    {
        return very_long(a) >= b;
    }
    friend bool operator >=(const very_long& a, const unsigned char& b)
    {
        return a >= very_long(b);
    }
    friend bool operator >=(const unsigned char& a, const very_long& b)
    {
        return very_long(a) >= b;
    }
    friend bool operator >=(const very_long& a, const char& b)
    {
        return a >= very_long(b);
    }
    friend bool operator >=(const char& a, const very_long& b)
    {
        return very_long(a) >= b;
    }
    friend bool operator >=(const very_long& a, const char b[])
    {
        string bb = b;
        return a >= very_long(bb);
    }
    friend bool operator >=(const char a[], const very_long& b)
    {
        string aa = a;
        return very_long(aa) >= b;
    }
    friend bool operator >=(const very_long& a, const string& b)
    {
        return a >= very_long(b);
    }
    friend bool operator >=(const string& a, const very_long& b)
    {
        return very_long(a) >= b;
    }
    very_long& operator+=(very_long a)
    {
        *this = *this + a;
        return *this;
    }
    very_long& operator-=(very_long a)
    {
        *this = *this - a;
        return *this;
    }
    friend very_long operator *(const very_long& a, const very_long& b)
    {
        very_long c;
        if (a.len == -2)
        {
            return a;
        }
        if (b.len == -2)
        {
            return b;
        }
        if (a.sign == b.sign)
        {
            c.sign = 1;
        }
        else
        {
            c.sign = 0;
        }
        if (a.len == -1 || b.len == -1)
        {
            c.len = -1;
            delete[]c.value;
            c.value = { 0 };
            if (a == very_long(0) || b == very_long(0))
                c = 0;
            return c;
        }
        c.len = a.len + b.len;
        delete[]c.value;
        c.value = new short[c.len];
        for (int i = 0; i != c.len; i++)
        {
            c.value[i] = 0;
        }
        for (int i = 0; i != a.len; i++)
        {
            for (int j = 0; j != b.len; j++)
            {
                c.value[i + j] += a.value[i] * b.value[j];
                c.value[i + j + 1] += c.value[i + j] / 10;
                c.value[i + j] %= 10;
            }
        }
        while (c.value[c.len - 1] == 0 && c.len != 1)
        {
            c.len = c.len - 1;
        }
        if (c.len == 1 && c.value[0] == 0)
        {
            c.sign = 1;
        }
        return c;
    }
    friend very_long operator *(const very_long& a, const int& b)
    {
        return a * very_long(b);
    }
    friend very_long operator *(const int& a, const very_long& b)
    {
        return very_long(a) * b;
    }
    friend very_long operator *(const very_long& a, const bool& b)
    {
        return a * very_long(b);
    }
    friend very_long operator *(const bool& a, const very_long& b)
    {
        return very_long(a) * b;
    }
    friend very_long operator *(const very_long& a, const long& b)
    {
        return a * very_long(b);
    }
    friend very_long operator *(const long& a, const very_long& b)
    {
        return very_long(a) * b;
    }
    friend very_long operator *(const very_long& a, const long long& b)
    {
        return a * very_long(b);
    }
    friend very_long operator *(const long long& a, const very_long& b)
    {
        return very_long(a) * b;
    }
    friend very_long operator *(const very_long& a, const short& b)
    {
        return a * very_long(b);
    }
    friend very_long operator *(const short& a, const very_long& b)
    {
        return very_long(a) * b;
    }
    friend very_long operator *(const very_long& a, const unsigned int& b)
    {
        return a * very_long(b);
    }
    friend very_long operator *(const unsigned int& a, const very_long& b)
    {
        return very_long(a) * b;
    }
    friend very_long operator *(const very_long& a, const unsigned long& b)
    {
        return a * very_long(b);
    }
    friend very_long operator *(const unsigned long& a, const very_long& b)
    {
        return very_long(a) * b;
    }
    friend very_long operator *(const very_long& a, const unsigned long long& b)
    {
        return a * very_long(b);
    }
    friend very_long operator *(const unsigned long long& a, const very_long& b)
    {
        return very_long(a) * b;
    }
    friend very_long operator *(const very_long& a, const unsigned short& b)
    {
        return a * very_long(b);
    }
    friend very_long operator *(const unsigned short& a, const very_long& b)
    {
        return very_long(a) * b;
    }
    friend very_long operator *(const very_long& a, const unsigned char& b)
    {
        return a * very_long(b);
    }
    friend very_long operator *(const unsigned char& a, const very_long& b)
    {
        return very_long(a) * b;
    }
    friend very_long operator *(const very_long& a, const char& b)
    {
        return a * very_long(b);
    }
    friend very_long operator *(const char& a, const very_long& b)
    {
        return very_long(a) * b;
    }
    friend very_long operator *(const very_long& a, const char b[])
    {
        string bb = b;
        return a * very_long(bb);
    }
    friend very_long operator *(const char a[], const very_long& b)
    {
        string aa = a;
        return very_long(aa) * b;
    }
    friend very_long operator *(const very_long& a, const string& b)
    {
        return a * very_long(b);
    }
    friend very_long operator *(const string& a, const very_long& b)
    {
        return very_long(a) * b;
    }
    very_long& operator*=(very_long a)
    {
        *this = *this * a;
        return *this;
    }
    friend very_long operator /(const very_long& a, const very_long& b)
    {
        very_long c, aa = a, bb = b, cc;
        if (a.len == -2)
        {
            return a;
        }
        if (b.len == -2)
        {
            return b;
        }
        if (b == very_long(0))
        {
            if (a == very_long(0))return very_long("nan");
            int x = 1, y = 0;
            cout << x / y;
        }
        if (a.len == -1)
        {
            if (b > very_long(0))
                return a;
            else
                return -a;
        }
        if (b.len == -1)
        {
            return very_long(0);
        }
        if (a == b)
        {
            c.sign = 1;
            c.len = 1;
            delete[]c.value;
            c.value = new short[1];
            c.value[0] = 1;
            return c;
        }
        if (a.sign == b.sign)
        {
            c.sign = 1;
        }
        else
        {
            c.sign = 0;
        }
        aa.sign = 1;
        bb.sign = 1;
        if (aa < bb)
        {
            cc = aa;
            aa = bb;
            bb = cc;
        }
        delete[]c.value;
        c.value = new short[aa.len - bb.len + 1];
        c.len = aa.len - bb.len + 1;
        for (int i = 0; i != c.len; i++)
        {
            c.value[i] = 0;
        }
        for (int i = aa.len - bb.len, k = aa.len; i != -1; i--)
        {
            delete[]cc.value;
            cc.len = k;
            cc.value = new short[cc.len];
            for (int j = 0; j != cc.len; j++)
            {
                cc.value[j] = 0;
            }
            for (int j = 0; j != bb.len; j++)
            {
                cc.value[j + i] = bb.value[j];
            }
            while (aa >= cc)
            {
                aa -= cc;
                c.value[i]++;
            }
            k--;
        }
        while (c.value[c.len - 1] == 0 && c.len != 1)
        {
            c.len = c.len - 1;
        }
        if (c.len == 1 && c.value[0] == 0)
        {
            c.sign = 1;
        }
        return c;
    }
    friend very_long operator /(const very_long& a, const int& b)
    {
        return a / very_long(b);
    }
    friend very_long operator /(const int& a, const very_long& b)
    {
        return very_long(a) / b;
    }
    friend very_long operator /(const very_long& a, const bool& b)
    {
        return a / very_long(b);
    }
    friend very_long operator /(const bool& a, const very_long& b)
    {
        return very_long(a) / b;
    }
    friend very_long operator /(const very_long& a, const long& b)
    {
        return a / very_long(b);
    }
    friend very_long operator /(const long& a, const very_long& b)
    {
        return very_long(a) / b;
    }
    friend very_long operator /(const very_long& a, const long long& b)
    {
        return a / very_long(b);
    }
    friend very_long operator /(const long long& a, const very_long& b)
    {
        return very_long(a) / b;
    }
    friend very_long operator /(const very_long& a, const short& b)
    {
        return a / very_long(b);
    }
    friend very_long operator /(const short& a, const very_long& b)
    {
        return very_long(a) / b;
    }
    friend very_long operator /(const very_long& a, const unsigned int& b)
    {
        return a / very_long(b);
    }
    friend very_long operator /(const unsigned int& a, const very_long& b)
    {
        return very_long(a) / b;
    }
    friend very_long operator /(const very_long& a, const unsigned long& b)
    {
        return a / very_long(b);
    }
    friend very_long operator /(const unsigned long& a, const very_long& b)
    {
        return very_long(a) / b;
    }
    friend very_long operator /(const very_long& a, const unsigned long long& b)
    {
        return a / very_long(b);
    }
    friend very_long operator /(const unsigned long long& a, const very_long& b)
    {
        return very_long(a) / b;
    }
    friend very_long operator /(const very_long& a, const unsigned short& b)
    {
        return a / very_long(b);
    }
    friend very_long operator /(const unsigned short& a, const very_long& b)
    {
        return very_long(a) / b;
    }
    friend very_long operator /(const very_long& a, const unsigned char& b)
    {
        return a / very_long(b);
    }
    friend very_long operator /(const unsigned char& a, const very_long& b)
    {
        return very_long(a) / b;
    }
    friend very_long operator /(const very_long& a, const char& b)
    {
        return a / very_long(b);
    }
    friend very_long operator /(const char& a, const very_long& b)
    {
        return very_long(a) / b;
    }
    friend very_long operator /(const very_long& a, const char b[])
    {
        string bb = b;
        return a / very_long(bb);
    }
    friend very_long operator /(const char a[], const very_long& b)
    {
        string aa = a;
        return very_long(aa) / b;
    }
    friend very_long operator /(const very_long& a, const string& b)
    {
        return a / very_long(b);
    }
    friend very_long operator /(const string& a, const very_long& b)
    {
        return very_long(a) / b;
    }
    friend very_long operator %(const very_long& a, const very_long& b)
    {
        very_long c, aa;
        if (a.len == -2)
        {
            return a;
        }
        if (b.len == -2)
        {
            return b;
        }
        aa = a;
        c = (a / b) * b;
        c = aa - c;
        return c;
    }
    friend very_long operator %(const very_long& a, const int& b)
    {
        return a % very_long(b);
    }
    friend very_long operator %(const int& a, const very_long& b)
    {
        return very_long(a) % b;
    }
    friend very_long operator %(const very_long& a, const bool& b)
    {
        return a % very_long(b);
    }
    friend very_long operator %(const bool& a, const very_long& b)
    {
        return very_long(a) % b;
    }
    friend very_long operator %(const very_long& a, const long& b)
    {
        return a % very_long(b);
    }
    friend very_long operator %(const long& a, const very_long& b)
    {
        return very_long(a) % b;
    }
    friend very_long operator %(const very_long& a, const long long& b)
    {
        return a % very_long(b);
    }
    friend very_long operator %(const long long& a, const very_long& b)
    {
        return very_long(a) % b;
    }
    friend very_long operator %(const very_long& a, const short& b)
    {
        return a % very_long(b);
    }
    friend very_long operator %(const short& a, const very_long& b)
    {
        return very_long(a) % b;
    }
    friend very_long operator %(const very_long& a, const unsigned int& b)
    {
        return a % very_long(b);
    }
    friend very_long operator %(const unsigned int& a, const very_long& b)
    {
        return very_long(a) % b;
    }
    friend very_long operator %(const very_long& a, const unsigned long& b)
    {
        return a % very_long(b);
    }
    friend very_long operator %(const unsigned long& a, const very_long& b)
    {
        return very_long(a) % b;
    }
    friend very_long operator %(const very_long& a, const unsigned long long& b)
    {
        return a % very_long(b);
    }
    friend very_long operator %(const unsigned long long& a, const very_long& b)
    {
        return very_long(a) % b;
    }
    friend very_long operator %(const very_long& a, const unsigned short& b)
    {
        return a % very_long(b);
    }
    friend very_long operator %(const unsigned short& a, const very_long& b)
    {
        return very_long(a) % b;
    }
    friend very_long operator %(const very_long& a, const unsigned char& b)
    {
        return a % very_long(b);
    }
    friend very_long operator %(const unsigned char& a, const very_long& b)
    {
        return very_long(a) % b;
    }
    friend very_long operator %(const very_long& a, const char& b)
    {
        return a % very_long(b);
    }
    friend very_long operator %(const char& a, const very_long& b)
    {
        return very_long(a) % b;
    }
    friend very_long operator %(const very_long& a, const char b[])
    {
        string bb = b;
        return a % very_long(bb);
    }
    friend very_long operator %(const char a[], const very_long& b)
    {
        string aa = a;
        return very_long(aa) % b;
    }
    friend very_long operator %(const very_long& a, const string& b)
    {
        return a % very_long(b);
    }
    friend very_long operator %(const string& a, const very_long& b)
    {
        return very_long(a) % b;
    }
    very_long& operator%=(very_long a)
    {
        *this = *this % a;
        return *this;
    }
    very_long& operator/=(very_long a)
    {
        *this = *this / a;
        return *this;
    }
    very_long& operator++()
    {
        *this += 1;
        return *this;
    }
    very_long& operator--()
    {
        *this -= 1;
        return *this;
    }
    very_long operator++(int)
    {
        very_long c = *this;
        *this += 1;
        return c;
    }
    very_long operator--(int)
    {
        very_long c = *this;
        *this -= 1;
        return c;
    }
};
const very_long Inf = "inf", NaN = "nan";
int main()
{
    very_long a, b;
    cin >> a >> b;
    cout << a + b<<endl;
    return 0;
}

顺便给你附带了减法、乘法、除法和取余,开心吧?


by Cload_Honor @ 2023-02-04 16:54:50

@Blood_red 变量名好评


上一页 |