/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Wrong Answer 1ms 320.0 KiB
#3 Wrong Answer 2ms 324.0 KiB

Code

/**
*	author: shafi
*	created: 06.03.2024 16.49.25
**/
#include "bits/stdc++.h"
using namespace std;
#define ll long long int

ll gcd(ll a, ll b){
	ll result = min(a, b); 
    while (result > 0) { 
        if (a % result == 0 && b % result == 0) { 
            break; 
        } 
        result--; 
    } 
    return result;
}
int main(){
	ios :: sync_with_stdio(false);
	cin.tie(0);

	int tc;
        cin>>tc;
	while(tc--){
		ll a,b,c;
		cin>>a>>b>>c;
		ll x;
		cin>>x;
		ll ans = (a*b)/gcd(a,b);
		ll ans2 = (ans*c)/gcd(ans,c);
		if(ans2 < x) cout<<ans2<<endl;
		else cout<<"-1\n";
	}
	return 0;
}

Information

Submit By
Type
Submission
Problem
P1025 GCM
Contest
Brain booster #2
Language
C++17 (G++ 13.2.0)
Submit At
2024-03-06 16:32:09
Judged At
2024-11-11 03:41:18
Judged By
Score
2
Total Time
2ms
Peak Memory
324.0 KiB