結果

問題 No.1663 Maximum Remainder
コンテスト
ユーザー mmn15277198
提出日時 2021-09-07 18:25:39
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 442 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 506 ms
コンパイル使用メモリ 104,664 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-29 16:13:49
合計ジャッジ時間 1,749 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {

  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  //cout << fixed << setprecision(15);
  
  int a , b , c , d , m;
  cin >> a >> b >> c >> d >> m;
  if (a + c <= m && m <= b + d) cout << m - 1 << endl;
  else cout << (b + d) % m << endl;
  return 0;
}
0