結果
| 問題 |
No.2882 Comeback
|
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2024-09-12 18:19:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 793 bytes |
| コンパイル時間 | 1,753 ms |
| コンパイル使用メモリ | 193,688 KB |
| 最終ジャッジ日時 | 2025-02-24 06:48:30 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using ll = std::int64_t;
int main(){
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
int T;
std::cin >> T;
for(int _=0;_<T;_++){
int A, B;
std::cin >> A >> B;
int res = 0;
int q1 = A / B;
int l1 = A / (q1 + 1);
int q2 = 1;
int l2 = B / (q2 + 1);
int r = B;
while(true){
int l = std::max(l1, l2);
if(q1 < q2){
res += std::max(r - std::max(l, (B - A + q2 - q1 - 1) / (q2 - q1) - 1), 0);
}
if(l == 0){break;}
r = l;
q1 = A / l;
l1 = A / (q1 + 1);
q2 = B / l;
l2 = B / (q2 + 1);
}
std::cout << res << std::endl;
}
}
tottoripaper