結果
問題 |
No.1006 Share an Integer
|
ユーザー |
|
提出日時 | 2020-03-07 05:59:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 613 bytes |
コンパイル時間 | 2,130 ms |
コンパイル使用メモリ | 197,328 KB |
最終ジャッジ日時 | 2025-01-09 05:42:33 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); int x; cin >> x; vector<int> scores(x + 1); iota(scores.begin(), scores.end(), 0); for (int i = 1; i <= x; i++) for (int j = i; j <= x; j += i) --scores[j]; int mi = 1 << 30; for (int i = 1; i < x; i++) mi = min(mi, abs(scores[i] - scores[x - i])); vector<pair<int, int>> ans; for (int i = 1; i < x; i++) if (abs(scores[i] - scores[x - i]) == mi) ans.emplace_back(i, x - i); for (auto& p : ans) { cout << p.first << " " << p.second << '\n'; } return 0; }