結果

問題 No.816 Beautiful tuples
ユーザー Enjapma_kyoproEnjapma_kyopro
提出日時 2018-06-26 21:23:46
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 4 ms / 1,500 ms
コード長 980 bytes
コンパイル時間 1,137 ms
コンパイル使用メモリ 83,620 KB
実行使用メモリ 8,524 KB
最終ジャッジ日時 2023-09-19 06:26:07
合計ジャッジ時間 2,163 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,352 KB
testcase_01 AC 4 ms
8,456 KB
testcase_02 AC 4 ms
8,352 KB
testcase_03 AC 4 ms
8,388 KB
testcase_04 AC 4 ms
8,456 KB
testcase_05 AC 4 ms
8,460 KB
testcase_06 AC 4 ms
8,404 KB
testcase_07 AC 4 ms
8,404 KB
testcase_08 AC 4 ms
8,320 KB
testcase_09 AC 4 ms
8,336 KB
testcase_10 AC 4 ms
8,408 KB
testcase_11 AC 4 ms
8,524 KB
testcase_12 AC 3 ms
8,524 KB
testcase_13 AC 4 ms
8,348 KB
testcase_14 AC 4 ms
8,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部0にする
 
vector<ll> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
 
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll a,b,c,d,e,ans=0;
ll x[100005],y[100005],z[100005];
 
int main(){
	cin>>a>>b;
	if(a>b)swap(a,b);
	if(a*2==b){
		p(a*3);
	}else if(a*3==b){
		p(a*2);
	}else if(a*3==b*2){
		p(b/3);
	}else{
		p(-1);
	}
	
	return 0;
}
0