結果
問題 | No.1006 Share an Integer |
ユーザー | 👑 tatyam |
提出日時 | 2020-03-03 02:49:05 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 91 ms / 2,000 ms |
コード長 | 523 bytes |
コンパイル時間 | 1,949 ms |
コンパイル使用メモリ | 194,536 KB |
実行使用メモリ | 11,308 KB |
最終ジャッジ日時 | 2024-04-21 23:36:42 |
合計ジャッジ時間 | 3,825 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 1 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 | AC | 36 ms
7,808 KB |
testcase_12 | AC | 82 ms
10,868 KB |
testcase_13 | AC | 91 ms
11,308 KB |
testcase_14 | AC | 91 ms
11,176 KB |
testcase_15 | AC | 71 ms
10,112 KB |
testcase_16 | AC | 26 ms
6,912 KB |
testcase_17 | AC | 36 ms
7,896 KB |
testcase_18 | AC | 74 ms
10,364 KB |
testcase_19 | AC | 61 ms
9,856 KB |
testcase_20 | AC | 76 ms
10,368 KB |
testcase_21 | AC | 90 ms
11,236 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; template<class T> bool chmin(T& a, const T& b){ if(a > b){ a = b; return 1; } return 0; } int main(){ int x; cin >> x; int divisor[x]; iota(divisor, divisor + x, 0); for(int i = 1; i < x; i++) for(int j = i; j < x; j += i) divisor[j]--; int min = 0x3fffffff; for(int i = 1; i <= x / 2; i++) chmin(min, abs(divisor[i] - divisor[x - i])); for(int i = 1; i < x; i++) if(abs(divisor[i] - divisor[x - i]) == min) cout << i << ' ' << x - i << endl; }