Submission #74357

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
743572018-08-31 11:02:26khsoo01The Ethereum and The Bitcoin (FXCUP2_ethereum)C++11
1 / 1
2 ms584 KiB
#include "ethereum.h"
#include <stdio.h>
typedef long long ll;
const ll v1 = 100000000, v2 = 99999999;
bool haja (excinfo &I) {
return (I.BTC == 0 || I.ETH == 0);
}
excinfo GetExchangePrice() {
ll r1, r2;
excinfo A = Exchange(v1), B = Exchange(v2);
bool B1 = haja(A), B2 = haja(B);
if(B1 && B2) {
if(A.BTC) r1 = v1 / A.BTC;
if(A.ETH) r2 = v1 / A.ETH;
if(B.BTC) r1 = v2 / B.BTC;
if(B.ETH) r2 = v2 / B.ETH;
}
else if(B1) {
if(A.BTC) {
r1 = v1 / A.BTC;
r2 = (v2 - B.BTC * r1) / B.ETH;
}
if(A.ETH) {
r2 = v1 / A.ETH;
r1 = (v2 - B.ETH * r2) / B.BTC;
}
}
else if(B2) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

ethereum.cpp: In function 'excinfo GetExchangePrice()':
ethereum.cpp:44:16: warning: 'r2' may be used uninitialized in this function [-Wmaybe-uninitialized]
  return {r1, r2};
                ^
ethereum.cpp:44:16: warning: 'r1' may be used uninitialized in this function [-Wmaybe-uninitialized]
#Verdict Execution timeMemoryGrader output
Fetching results...