結果

問題 No.2921 Seated in Classroom
ユーザー Mizuno
提出日時 2024-10-12 15:44:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 365 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 63,828 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 15:44:30
合計ジャッジ時間 2,964 ms
ジャッジサーバーID
(参考情報)
judge3 / judge
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin >> n;
    for(int i = 0; i < n; i++) {
        int charge,normal;
        cin >> charge >> normal;
        int a = charge / 4;
        if(charge % 4 > 0)a++;
        int b = normal;
        if(charge % 4 != 0)b -= 4 - charge % 4;
        int c = 0;
        b -= a * 4;
        if(b < 0){
            cout << a << endl;
        } else {
            c = a;
            c += b / 8;
            if(b % 8 != 0)c++;
            cout << c << endl;
        }
    } 
}
0