QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#711198#9241. Sphinxivan_alexeev#Compile Error//C++232.5kb2024-11-05 01:50:032024-11-05 01:50:04

Judging History

你现在查看的是最新测评结果

  • [2024-11-05 01:50:04]
  • 评测
  • [2024-11-05 01:50:03]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const ll base = 1'000'000'000'000'000'000;
 
struct lox{
    vector<ll> a;
    void norm(){
        while((a.size() > 1) && (a.back() == 0)){
            a.pop_back();
        }
    }
};
 
lox operator+(const lox &a, const lox &b){
    lox ans;
    ans.a.resize(max(a.a.size(), b.a.size()) + 1);
    int n = max(a.a.size(), b.a.size());
    for(int i = 0; i < n; i++){
        if(a.a.size() > i){
            ans.a[i] += a.a[i];
        }
        if(b.a.size() > i){
            ans.a[i] += b.a[i];
        }
        while(ans.a[i] >= base){
            ans.a[i] -= base;
            ans.a[i + 1]++;
        }
    }
    ans.norm();
    return ans;
}
 
lox operator-(const lox &a, const lox &b){
    lox ans;
    ans.a.resize(max(a.a.size(), b.a.size()));
    int n = max(a.a.size(), b.a.size());
    for(int i = 0; i < n; i++){
        if(a.a.size() > i){
            ans.a[i] += a.a[i];
        }
        if(b.a.size() > i){
            ans.a[i] -= b.a[i];
        }
        while(ans.a[i] < 0){
            ans.a[i] += base;
            ans.a[i + 1]--;
        }
    }
    ans.norm();
    return ans;
}
 
bool operator<(const lox &a, const lox &b){
    if(a.a.size() != b.a.size()){
        return a.a.size() < b.a.size();
    }else{
        for(int i = a.a.size() - 1; i >= 0; i--){
            if(a.a[i] != b.a[i]){
                return a.a[i] < b.a[i];
            }
        }
        return 0;
    }
}
 
bool operator>(const lox &a, const lox &b){
    return (b < a);
}
 
bool operator>=(const lox &a, const lox &b){
    return !(a < b);
}
 
bool operator<=(const lox &a, const lox &b){
    return (b >= a);
}
 
string s;
istream& operator >> (istream& in, lox &a) {
    cin >> s;
    std::reverse(s.begin(), s.end());
    for(int i = 0; i < s.size(); i += 18){
        string s1 = s.substr(i, 18);
        std::reverse(s1.begin(), s1.end());
        a.a.push_back(stoll(s1));
    }
    a.norm();
    return in;
}
 
ostream& operator <<(ostream& out, lox &a){
    for(auto i = a.a.rbegin(); i != a.a.rend(); i++){
    	if(i != a.a.rbegin()){
        	string s = to_string(base + *i);
        	cout << s.substr(1, s.size());
    	}else{
    		cout << *i;
    	}
    }
    return out;
}
 



signed main(){
	int t;
	cin >> t;
	string s;
	cin >> s;
	cout << t << endl;
	cout << s << "111" << endl;
	return 0;
	vector<lox> z(t);
	lox a, b, c;
	a = {{1}};
	b = {{1}};
	for(int i = 2; i < t; i++){
		c = a + b;
		a  = b;
		b = c;
	}
	cout << "1\n";
	cout << b << endl;
}

詳細信息

/usr/bin/ld: /tmp/ccipeU6E.o: in function `main':
answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/cc9H1IKF.o:implementer.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc9H1IKF.o: in function `main':
implementer.cpp:(.text.startup+0x17f): undefined reference to `find_colours(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status