# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28181 | (#71) | The Ethereum and The Bitcoin (FXCUP2_ethereum) | C++11 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "ethereum.h"
#include <stdio.h>
excinfo GetExchangePrice() {
long long V1 = 100000000, V2 = 99999999;
excinfo A = Exchange(V1);
excinfo B = Exchange(V2);
long long BTC = 0, ETH = 0;
long long X = A.ETH * B.BTC - A.BTC * B.ETH;
long long Y = B.BTC * V1 - A.BTC * V2;
long long ETH = Y / X;
long long BTC = (A.BTC != 0 ? (V1 - A.ETH * ETH) / A.BTC
: (V2 - B.ETH * ETH) / B.BTC);
excinfo ret; ret.BTC = BTC; ret.ETH = ETH;
return ret;
}