結果

問題 No.537 ユーザーID
ユーザー Amanita2016Amanita2016
提出日時 2017-07-01 13:18:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 469 ms / 2,000 ms
コード長 1,206 bytes
コンパイル時間 2,401 ms
コンパイル使用メモリ 79,352 KB
実行使用メモリ 79,096 KB
最終ジャッジ日時 2024-04-15 09:57:01
合計ジャッジ時間 10,101 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
71,660 KB
testcase_01 AC 148 ms
71,284 KB
testcase_02 AC 147 ms
71,476 KB
testcase_03 AC 153 ms
71,516 KB
testcase_04 AC 152 ms
71,276 KB
testcase_05 AC 150 ms
71,620 KB
testcase_06 AC 150 ms
71,468 KB
testcase_07 AC 152 ms
71,312 KB
testcase_08 AC 151 ms
71,196 KB
testcase_09 AC 152 ms
71,504 KB
testcase_10 AC 147 ms
71,404 KB
testcase_11 AC 152 ms
71,592 KB
testcase_12 AC 183 ms
71,404 KB
testcase_13 AC 154 ms
71,328 KB
testcase_14 AC 150 ms
71,620 KB
testcase_15 AC 159 ms
71,464 KB
testcase_16 AC 154 ms
71,540 KB
testcase_17 AC 150 ms
71,656 KB
testcase_18 AC 175 ms
71,736 KB
testcase_19 AC 169 ms
71,664 KB
testcase_20 AC 169 ms
71,260 KB
testcase_21 AC 172 ms
71,540 KB
testcase_22 AC 173 ms
71,508 KB
testcase_23 AC 204 ms
73,304 KB
testcase_24 AC 168 ms
71,664 KB
testcase_25 AC 185 ms
71,912 KB
testcase_26 AC 177 ms
71,380 KB
testcase_27 AC 170 ms
71,344 KB
testcase_28 AC 302 ms
74,580 KB
testcase_29 AC 469 ms
79,096 KB
testcase_30 AC 317 ms
76,404 KB
testcase_31 AC 173 ms
71,664 KB
testcase_32 AC 171 ms
71,640 KB
testcase_33 AC 304 ms
74,368 KB
testcase_34 AC 209 ms
73,036 KB
権限があれば一括ダウンロードができます

ソースコード

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