結果
問題 |
No.2921 Seated in Classroom
|
ユーザー |
|
提出日時 | 2024-10-28 23:30:23 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 169 ms / 2,000 ms |
コード長 | 521 bytes |
コンパイル時間 | 1,907 ms |
コンパイル使用メモリ | 192,400 KB |
最終ジャッジ日時 | 2025-02-25 01:12:39 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(), (a).end() int main() { cin.tie(nullptr); int T; cin >> T; rep(test, 0, T) { ll N, M; cin >> N >> M; ll k = (N + 3) / 4; ll left = 8 * k - N; if (left >= M) cout << k << '\n'; else { ll d = M - left; cout << k + (d + 7) / 8 << '\n'; } } }