結果
問題 | No.2142 Segment Zero |
ユーザー |
|
提出日時 | 2022-12-03 01:47:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 517 bytes |
コンパイル時間 | 1,943 ms |
コンパイル使用メモリ | 192,332 KB |
最終ジャッジ日時 | 2025-02-09 04:38:02 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main () { ll N, K; cin >> N >> K; K = (N * (N + 1)) / 2 - K; K *= 2; for (ll x = 1; x * x <= K; x ++) { if (K % x) { continue; } ll y = K / x; if ((x + y) % 2 == 0) { continue; } ll a = (y + (x - 1)) / 2, b = (y - (x - 1)) / 2; if (1 <= b && a <= N) { cout << 1 << endl; return 0; } } cout << 2 << endl; }