結果
| 問題 | No.2921 Seated in Classroom | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-10-14 13:33:24 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 284 ms / 2,000 ms | 
| コード長 | 447 bytes | 
| コンパイル時間 | 2,023 ms | 
| コンパイル使用メモリ | 193,248 KB | 
| 最終ジャッジ日時 | 2025-02-24 19:27:26 | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 5 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#include<atcoder/modint>
using namespace atcoder;
using mint=modint998244353;
void solve(){
    ll N,M;
    cin>>N>>M;
    ll B=(N+3)/4;
    ll Z=B*8-N;
    if(M<=Z){
        cout<<B<<endl;
    }
    else{
        cout<<B+(M-Z+7)/8<<endl;
    }
}
int main(){
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll T;
    cin>>T;
    while(T--)
    solve();
}
            
            
            
        