結果

問題 No.2921 Seated in Classroom
ユーザー ありあけ
提出日時 2024-10-12 15:11:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 945 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 36,736 KB
最終ジャッジ日時 2024-10-12 15:11:09
合計ジャッジ時間 5,245 ms
ジャッジサーバーID
(参考情報)
judge5 / judge
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
query = []
for i in range(T):
    n,m = map(int,input().split())
    query.append([n,m])
for q in query:
    N = q[0]
    M = q[1]
    need = (N-1)//4 + 1
    amari = need*4 - N
#    print(need,amari)
    M -= amari
    if need*4 >= M:
        print(need)
        continue
    else:
        M -= need*4
        nokori = (M-1) //8 + 1
        print(need + nokori)
0