結果

問題 No.2051 Divide
ユーザー viral8viral8
提出日時 2022-10-01 10:37:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 72,416 KB
実行使用メモリ 57,932 KB
最終ジャッジ日時 2023-08-25 03:05:17
合計ジャッジ時間 6,250 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,752 KB
testcase_01 AC 118 ms
56,208 KB
testcase_02 AC 116 ms
55,984 KB
testcase_03 AC 117 ms
56,028 KB
testcase_04 AC 117 ms
55,892 KB
testcase_05 AC 120 ms
56,000 KB
testcase_06 AC 118 ms
55,824 KB
testcase_07 AC 118 ms
56,548 KB
testcase_08 AC 119 ms
55,976 KB
testcase_09 AC 119 ms
55,996 KB
testcase_10 AC 117 ms
56,096 KB
testcase_11 AC 118 ms
56,268 KB
testcase_12 AC 119 ms
56,044 KB
testcase_13 AC 117 ms
56,520 KB
testcase_14 AC 119 ms
57,932 KB
testcase_15 AC 119 ms
55,948 KB
testcase_16 AC 117 ms
53,812 KB
testcase_17 AC 120 ms
56,080 KB
testcase_18 AC 115 ms
56,016 KB
testcase_19 AC 121 ms
55,392 KB
testcase_20 AC 117 ms
55,420 KB
testcase_21 AC 115 ms
56,116 KB
testcase_22 AC 119 ms
56,248 KB
testcase_23 AC 121 ms
56,012 KB
testcase_24 AC 122 ms
55,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.HashSet;
class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		HashSet<Integer> list = new HashSet<Integer>();
		list.add(A);
		for(int i=1;i<=Math.sqrt(A);i++)
			if(A%i==0){
				list.add(i);
				list.add(A/i);
            }
		int ans = 0;
		for(int tmp:list)
			if(tmp%B==0)
				ans++;
		System.out.println(ans);
	}
}
0