結果
| 問題 | No.3502 GCD Knapsack |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-18 04:08:15 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 894 bytes |
| 記録 | |
| コンパイル時間 | 1,123 ms |
| コンパイル使用メモリ | 164,888 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-18 04:08:19 |
| 合計ジャッジ時間 | 3,055 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 35 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
void solve() {
ll N, K;
if (!(cin >> N >> K)) return;
if (N == 1 || K < 2) {
cout << "Bob" << endl;
return;
}
ll divisor_count = 0;
for (ll d = 1; d * d <= N; ++d) {
if (N % d == 0) {
// Ước nhỏ d
if (d >= 2 && d <= K) {
divisor_count++;
}
// Ước lớn N/d
ll other = N / d;
if (other != d) {
if (other >= 2 && other <= K) {
divisor_count++;
}
}
}
}
if (divisor_count % 2 != 0) {
cout << "Alice" << endl;
} else {
cout << "Bob" << endl;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}