結果

問題 No.537 ユーザーID
ユーザー masakiGit
提出日時 2019-04-12 12:01:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 1,334 ms
コンパイル使用メモリ 97,236 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-13 22:35:52
合計ジャッジ時間 2,560 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <math.h>
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;

int main() {
  long n, half, cnt;
  vector<string> array;
  cin >> n;
  half = (long)sqrt(n);
  cnt = 0;
  for (int i = 1; i <= half; i++) {
    if (n % i == 0) {
      array.push_back(to_string(i) + to_string(n / i));
      array.push_back(to_string(n / i) + to_string(i));
    }
  }
  std::sort(array.begin(), array.end());
  cnt = 0;
  set<string> ans;
  for (int i = 0; i < array.size(); i++) {
    ans.insert(array[i]);
  }
  cout << ans.size() << endl;
}
0