제출 #28183

#제출 시각아이디문제언어결과실행 시간메모리
28183 (#71)The Ethereum and The Bitcoin (FXCUP2_ethereum)C++11
1 / 1
0 ms1120 KiB
#include "ethereum.h"
#include <stdio.h>

excinfo GetExchangePrice() {
  long long V1 = 100000000, V2 = 99999999;
  excinfo A = Exchange(V1);
  excinfo B = Exchange(V2);

  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;
}
#Verdict Execution timeMemoryGrader output
Fetching results...