# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
28164 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (#71) | The Ethereum and The Bitcoin (FXCUP2_ethereum) | C++14 | 0 ms | 2164 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 excinfo kinf;
static void get(int value){
excinfo tmp = Exchange(value);
x = tmp.BTC; y = tmp.ETH;
}
static long long gcd(long long x,long long y){
return x ? gcd(y%x,x) : y;
}
static excinfo tmpextgcd(long long a, long long b){
excinfo res, im;
// a * BTC + b * ETH = gcd
if(!b){ // a = gcd
res.BTC = 1, res.ETH = 0;
return res;
}
im = tmpextgcd(b, a%b); long long q = a/b;
// a = bq + r : (bq+r) BTC + b ETH = b(q BTC + ETH) + r BTC = gcd
res.BTC = im.ETH; res.ETH = im.BTC - q * res.BTC;
return res;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |