結果
| 問題 | No.2142 Segment Zero | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-01-28 22:09:06 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 13 ms / 2,000 ms | 
| コード長 | 442 bytes | 
| コンパイル時間 | 598 ms | 
| コンパイル使用メモリ | 66,520 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-28 23:40:41 | 
| 合計ジャッジ時間 | 2,195 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 35 | 
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	long long n, k; cin >> n >> k;
	k = n * (n + 1LL) / 2 - k; k *= 2;
	for (long long i = 1; i * i < k; i++) {
		if (k % i != 0) continue;
		long long r = k / i;
		if ((r + i - 1LL) & 1LL) continue;
		long long y = (r + i - 1LL) / 2;
		if (y <= n) {
			cout << 1 << '\n';
			return 0;
		}
	}
	cout << 2 << '\n';
	return 0;
}
            
            
            
        