結果

問題 No.537 ユーザーID
ユーザー Amanita2016Amanita2016
提出日時 2017-07-01 13:18:49
言語 Java
(openjdk 23)
結果
AC  
実行時間 327 ms / 2,000 ms
コード長 1,206 bytes
コンパイル時間 1,977 ms
コンパイル使用メモリ 79,016 KB
実行使用メモリ 76,656 KB
最終ジャッジ日時 2024-10-05 03:29:49
合計ジャッジ時間 8,415 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long[] x1 = new long [1000000];
		long[] x2 = new long [1000000];
		int cnt = 0;
		for(long i = 1 ; i <= 1000000 ; i++){
			if((n%i)==0){
				long ans = n / i ;
				if(ans > i){
					x1[cnt] = ans;
					x2[cnt] = i;
					cnt++;
				}else if(ans == i){
					x1[cnt] = ans;
					x2[cnt] = i;
					cnt++;
					break ;
				}else{
					break ;
				}
			}
		}
		String comb[] = new String[cnt*2+1];
		int x = 0;
		for(int i = 0 ; i < cnt ; i++){
			boolean flg = true;
			String str = Long.toString(x1[i]) + Long.toString(x2[i]);
			for(int j = 0 ; j < x ; j++){
				if(str.equals(comb[j])){
					flg = false;
					break;
				}
			}
			if(flg){
				comb[x] = str;
				x++;
			}
			flg = true;
			if(x1[i] != x2[i]){
				str = Long.toString(x2[i]) + Long.toString(x1[i]);
				for(int j = 0 ; j < x ; j++){
					if(str.equals(comb[j])){
						flg = false;
						break;
					}
				}
				if(flg){
					comb[x] = str;
					x++;
				}
			}
		}
	    System.out.println(x);
	}

}
0