답안 #28183

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
28183 2017-07-15T14:18:39 Z (#1210, xdoju) 이더리움과 비트코인 (FXCUP2_ethereum) C++11
1 / 1
0 ms 1120 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1120 KB Output is correct
2 Correct 0 ms 1120 KB Output is correct
3 Correct 0 ms 1120 KB Output is correct
4 Correct 0 ms 1120 KB Output is correct
5 Correct 0 ms 1120 KB Output is correct
6 Correct 0 ms 1120 KB Output is correct
7 Correct 0 ms 1120 KB Output is correct
8 Correct 0 ms 1120 KB Output is correct
9 Correct 0 ms 1120 KB Output is correct
10 Correct 0 ms 1120 KB Output is correct
11 Correct 0 ms 1120 KB Output is correct
12 Correct 0 ms 1120 KB Output is correct
13 Correct 0 ms 1120 KB Output is correct
14 Correct 0 ms 1120 KB Output is correct
15 Correct 0 ms 1120 KB Output is correct
16 Correct 0 ms 1120 KB Output is correct
17 Correct 0 ms 1120 KB Output is correct
18 Correct 0 ms 1120 KB Output is correct
19 Correct 0 ms 1120 KB Output is correct
20 Correct 0 ms 1120 KB Output is correct