Submission #28179

# Submission time Handle Problem Language Result Execution time Memory
28179 2017-07-15T14:17:37 Z IE(#1205, kriii) The Ethereum and The Bitcoin (FXCUP2_ethereum) C++
Compilation error
0 ms 0 KB
#include "ethereum.h"
#include <algorithm>
using namespace std;

pair<long long, long long> extended_gcd(long long a, long long b) {
	if (b == 0) return make_pair(1, 0);
	pair<long long, long long> t = extended_gcd(b, a % b);
	return make_pair(t.second, t.first - t.second * (a / b));
}

excinfo GetExchangePrice() {
	excinfo A = Exchange(100000000);
	excinfo B = Exchange(99999999);
	long long p = A.BTC - B.BTC;
	long long q = A.ETH - B.ETH;

	excinfo ret;
	if (p >= 0 && q <= 0){
		auto v = extended_gcd(p,-q);
		ret.BTC = v.first;
		ret.ETH = -v.second;
	}
	else{
		auto v = extended_gcd(-p,q);
		ret.BTC = -v.first;
		ret.ETH = v.second;
	}
	return ret;
}

Compilation message

ethereum.cpp: In function 'excinfo GetExchangePrice()':
ethereum.cpp:19:3: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
   auto v = extended_gcd(p,-q);
   ^
ethereum.cpp:19:8: error: 'v' does not name a type
   auto v = extended_gcd(p,-q);
        ^
ethereum.cpp:20:13: error: 'v' was not declared in this scope
   ret.BTC = v.first;
             ^
ethereum.cpp:24:3: warning: 'auto' changes meaning in C++11; please remove it [-Wc++0x-compat]
   auto v = extended_gcd(-p,q);
   ^
ethereum.cpp:24:8: error: 'v' does not name a type
   auto v = extended_gcd(-p,q);
        ^
ethereum.cpp:25:14: error: 'v' was not declared in this scope
   ret.BTC = -v.first;
              ^