# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28136 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (#71) | The Ethereum and The Bitcoin (FXCUP2_ethereum) | C++14 | 0 ms | 2024 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 <bits/stdc++.h>
#define pii pair<int,int>
#define pb push_back
using namespace std;
static int a,b,x,y;
static void get(int value){
excinfo tmp = Exchange(value);
x = tmp.BTC; y = tmp.ETH;
}
static int gcd(int x,int y){
return x ? gcd(y%x,x) : y;
}
excinfo GetExchangePrice() {
int value;
value = 100000000; get(value);
if(x != -1){
vector<pii> tmp;
for(int i=2; i<=10000; i++){
if(i*x > value) break;
if((value-i*x)%y != 0) continue;
int j = (value-i*x)/y;
if(gcd(i,j) != 1 || j > 10000) continue;
tmp.pb({i,j});
}
a = tmp.back().first;
b = tmp.back().second;
}else exit(-1);
excinfo ans;
ans.BTC = a; ans.ETH = b;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |