結果
問題 |
No.846 メダル
|
ユーザー |
![]() |
提出日時 | 2020-05-13 01:55:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 861 bytes |
コンパイル時間 | 1,661 ms |
コンパイル使用メモリ | 167,056 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-09-14 05:42:51 |
合計ジャッジ時間 | 5,294 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 4 |
other | AC * 6 WA * 2 TLE * 1 -- * 13 |
ソースコード
#include <bits/stdc++.h> #define PI 3.14159265359 using namespace std; int main() { int64_t P, Q, R, A, B, C; cin >> P >> Q >> R >> A >> B >> C; int64_t N = 0; int f = 0; int64_t n = P * (A - 1) + 1, m = P * (A + 1) - 1; //cout << "n:" << n << ' ' << "m:" << m << endl; int64_t min = -1, max = -1; for (int64_t i = n; i <= m; i++) { int64_t x = i % Q; if (x) { x = i / Q; x++; } else { x = i / Q; } //cout << "x:" << x << endl; x -= A; if (x == B) { int64_t y = i % R; if (y) { y = i / R; y++; } else { y = i / R; } y -= (A + B); if (y == C) { if (!f) { min = i; f = 1; } else { max = i; } //cout << "push" << endl; } } else { continue; } } if (!f) { cout << -1 << endl; return 0; } else { cout << min << ' ' << max << endl; } }