# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
12208 | qja0950 | Min-cost GCD (GA9_mcg) | C++98 | 301 ms | 1084 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.
//
// main.cpp
// 2. Min-cost GCD (mcg)
//
// Created by KJBS2 on 2014. 12. 24..
// Copyright (c) 2014년 KJBS2. All rights reserved.
//
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long ll;
#define MAX_LL ((ll)1*0x7fffffff*0x7fffffff)
ll A, B, P, Q;
ll X, Y, Z, W;
void PROCESS() {
scanf("%lld%lld%lld%lld", &A, &B, &P, &Q);
X = 0; Y = MAX_LL;
for(; A!=0 && B!=0;) {
ll C = A % B, D = A / B;
Z = X + P;
if( (MAX_LL - X) / Q >= D) W = X + D * Q;
else W = MAX_LL;
if(Y != MAX_LL) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |