結果

問題 No.1663 Maximum Remainder
ユーザー kyo1
提出日時 2021-10-19 21:38:03
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 336 bytes
コンパイル時間 2,017 ms
コンパイル使用メモリ 192,988 KB
最終ジャッジ日時 2025-01-25 01:55:18
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int A, B, C, D, M;
  cin >> A >> B >> C >> D >> M;
  int res = 0;
  for (int i = A; i < B + 1; i++) {
    for (int j = C; j < D + 1; j++) {
      res = max(res, (i + j) % M);
    }
  }
  cout << res << '\n';
  return 0;
}
0