結果

問題 No.1423 Triangle of Multiples
ユーザー chacoder1chacoder1
提出日時 2021-03-25 21:02:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 627 bytes
コンパイル時間 1,820 ms
コンパイル使用メモリ 200,428 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-05 10:20:43
合計ジャッジ時間 2,621 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 78 ms
5,376 KB
testcase_03 AC 72 ms
5,376 KB
testcase_04 AC 68 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int,int>P;

ll x[3];
int main(){
  int t;
  cin>>t;
  rep(i,t){
    ll a,b,c;
    cin>>a>>b>>c;
    x[0]=a;
    x[1]=b;
    x[2]=c;
    while(1){
      //cout<<a<<" "<<b<<" "<<c<<endl;
    if(a+b>c && a+c>b && a<b+c){
      cout<<a<<" "<<b<<" "<<c<<endl;
      break;
    }
    if(c<=a && c<=b){
      c+=(x[2]*(max(a,b)/c));
      continue;
    }
    if(a<=b && a<=c){
      a+=(x[0]*(max(b,c)/a));
      continue;
    }
    if(b<=a && b<=c){
      b+=(x[1]*(max(c,a)/b));
      continue;
    }
    }
  }
}
0