Submission #28136

#TimeUsernameProblemLanguageResultExecution timeMemory
28136aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (#71)The Ethereum and The Bitcoin (FXCUP2_ethereum)C++14
0 / 1
0 ms2024 KiB
#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 timeMemoryGrader output
Fetching results...