結果

問題 No.2921 Seated in Classroom
ユーザー mikan0131
提出日時 2025-01-09 15:56:20
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 450 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 2,240 ms
コンパイル使用メモリ 193,416 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-09 15:56:27
合計ジャッジ時間 6,442 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int T;

int cal_c(int x, int mod) {
	int sho = x / mod;
	int r = x % mod;
	if (r == 0) return sho;
	else return sho + 1;
}

int main() {
	cin >> T;
	for (int i = 1; i <= T; i++) {
		int N, M;
		cin >> N >> M;
		int N_c = cal_c(N, 4);
		int M_c = cal_c(M, 4);
		if (M_c <= N_c) cout << N_c << endl;
		else {
			cout << cal_c(N + M, 8) << endl;
		}
	}
	return 0;
}
0