結果

問題 No.358 も~っと!門松列
ユーザー shinwisteria
提出日時 2017-04-01 23:17:03
言語 Java
(openjdk 23)
結果
AC  
実行時間 114 ms / 1,000 ms
コード長 728 bytes
コンパイル時間 3,742 ms
コンパイル使用メモリ 77,524 KB
実行使用メモリ 41,284 KB
最終ジャッジ日時 2024-07-07 19:16:40
合計ジャッジ時間 6,185 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Moreakadomatsu {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner s = new Scanner(System.in);
		int[] A = new int[3];
		for(int i = 0;i < 3;i++){
			A[i] = s.nextInt();
		}
		s.close();
		if(((A[0] > A[1] && A[2] > A[1]) ||( A[0] < A[1]&&A[2] < A[1])) && A[0]!=A[2]){
			System.out.println("INF");
		}else{
			int count = 0;
			for(int i =2;i <= Math.max(A[0], Math.max(A[1], A[2]));i++){
				int a0 = A[0]%i;
				int a1 = A[1]%i;
				int a2 = A[2]%i;
				if(((a0 >a1 && a2 > a1)||(a0 < a1&&a2 < a1)) && a0 != a2){
					count++;
					//System.out.println(a0+"  "+a1+ "  "+a2);
				}
			}
			System.out.println(count);
		}

	}

}
0