結果

問題 No.1006 Share an Integer
ユーザー m-44m-44
提出日時 2020-03-07 19:52:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 500 bytes
コンパイル時間 1,509 ms
コンパイル使用メモリ 172,172 KB
実行使用メモリ 43,776 KB
最終ジャッジ日時 2024-04-23 14:16:41
合計ジャッジ時間 5,166 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 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 2 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 3 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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int d(int n) {
  int cnt = 0;
  for (int i=1; i<=sqrt(n); i++) {
    if (n % i == 0) {
      ++cnt;
      if (i != n / i) {
        ++cnt;
      }
    }
  }
  return cnt;
}
int main() {
  int x;
  cin>>x;
  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;
  }
}
0