結果
問題 | No.1006 Share an Integer |
ユーザー | m-44 |
提出日時 | 2020-03-07 19:55:20 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 553 bytes |
コンパイル時間 | 1,706 ms |
コンパイル使用メモリ | 172,032 KB |
実行使用メモリ | 15,668 KB |
最終ジャッジ日時 | 2024-04-23 14:18:41 |
合計ジャッジ時間 | 5,034 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
12,544 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; int d[2000001]; int main() { int x; cin>>x; for (int n=1; n<=x; n++) { int cnt = 0; for (int i=1; i<=sqrt(n); i++) { if (n % i == 0) { ++cnt; if (i != n / i) { ++cnt; } } } d[n] = cnt; } map<int, vector<int>> m; for (int i=1; i<x; i++) { int fa = i - d[i]; int fb = x - i - d[x - i]; m[abs(fa-fb)].push_back(i); } for (auto e: m) { for (int i: e.second) { cout<<i<<" "<<x - i<<endl; } break; } }