Submission #28136

# Submission time Handle Problem Language Result Execution time Memory
28136 2017-07-15T12:45:29 Z aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(#1199, suhgyuho_william) The Ethereum and The Bitcoin (FXCUP2_ethereum) C++14
0 / 1
0 ms 2024 KB
#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
1 Correct 0 ms 2024 KB Output is correct
2 Correct 0 ms 2024 KB Output is correct
3 Correct 0 ms 2024 KB Output is correct
4 Correct 0 ms 2024 KB Output is correct
5 Correct 0 ms 2024 KB Output is correct
6 Correct 0 ms 2024 KB Output is correct
7 Incorrect 0 ms 2024 KB Output isn't correct
8 Halted 0 ms 0 KB -