結果

問題 No.537 ユーザーID
ユーザー onsen_manjuuu
提出日時 2020-08-29 17:15:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 516 bytes
コンパイル時間 1,868 ms
コンパイル使用メモリ 179,876 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-14 14:16:43
合計ジャッジ時間 3,011 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long;

template<class T>
vector<T> divisor(T n){
	vector<T> res;
	for(T i = 1; i * i <= n; i++){
		if(n % i == 0){
			res.push_back(i);
			T j = n / i;
			if(i != j)res.push_back(j);
		}
	}
	sort(res.begin(),res.end());
	return res;
}

int main()
{
	ll n; cin >> n;
	vector<ll> a = divisor(n);
	set<string> st;
	for(auto i : a) {
		ll j = n / i;
		string si = to_string(i), sj = to_string(j);
		si += sj;
		st.insert(si);
	}
	cout << st.size() << endl;
}
0