結果
問題 | No.1423 Triangle of Multiples |
ユーザー | lynmisakura |
提出日時 | 2021-01-02 17:14:11 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 774 bytes |
コンパイル時間 | 2,292 ms |
コンパイル使用メモリ | 197,832 KB |
実行使用メモリ | 13,880 KB |
最終ジャッジ日時 | 2024-04-21 18:54:53 |
合計ジャッジ時間 | 6,069 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
10,016 KB |
testcase_01 | AC | 3 ms
6,944 KB |
testcase_02 | AC | 80 ms
6,940 KB |
testcase_03 | AC | 68 ms
6,944 KB |
testcase_04 | TLE | - |
ソースコード
// solution for yukicoder_5395 // author : lynmisakura #include<bits/stdc++.h> using namespace std; using ll = long long; #define REP(i,N) for(int i=0;i<N;i++) ll in[3]; pair<ll,int> a[3]; void main2(){ REP(i,3) cin >> in[i] , a[i].first = in[i], a[i].second = i; sort(a,a+3); if(a[0].first == 1 && a[1].first == 1 && a[2].first == 1000000){ a[0].first = 1000000 , a[1].first = 1000000; }else{ while(a[0].first + in[a[0].second] <= a[2].first){ a[0].first += in[a[0].second]; } while(a[1].first + in[a[1].second] <= a[2].first){ a[1].first += in[a[1].second]; } } REP(i,3)REP(j,3) if(a[j].second == i)cout << a[j].first << (i < 2 ? ' ': '\n'); } int main(void){ int t;cin >> t; while(t--) main2(); }