結果

問題 No.2051 Divide
ユーザー viral8
提出日時 2022-10-01 10:37:54
言語 Java
(openjdk 23)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 2,770 ms
コンパイル使用メモリ 75,128 KB
実行使用メモリ 41,600 KB
最終ジャッジ日時 2024-12-23 15:07:49
合計ジャッジ時間 7,469 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

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