結果

問題 No.537 ユーザーID
ユーザー Ronlynes
提出日時 2017-07-01 00:13:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 1,019 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 70,640 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-04 22:06:44
合計ジャッジ時間 1,769 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
using namespace std;
vector<string> vec;
long long all = 0;

bool judge(string s){
    for(int i=0;i<all;i++){
        if(vec[i] == s){
            return false;
        }
    }
    return true;
}

int main(void){
    long long n, cnt=0;
    cin >> n;
    for(long long i=1;i<=sqrt(n);i++){
        if(n%i == 0){
            
            long long j = n/i;
            string s1 = to_string(i);
            string s2 = to_string(j);

            if( (s1+s2) == (s2+s1) ){
                if(judge(s1+s2)){
                    vec.push_back(s1+s2);
                    all++;
                }
            }else{
                if(judge(s1+s2)){
                    vec.push_back(s1+s2);
                    all++;
                }
                if(judge(s2+s1)){
                    vec.push_back(s2+s1);
                    all++;
                }
            }
        }    
    }
    cout << all << endl;

    return 0;
}
0