結果

問題 No.415 ぴょん
ユーザー GrenacheGrenache
提出日時 2016-08-26 22:39:51
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,573 bytes
コンパイル時間 4,280 ms
コンパイル使用メモリ 78,748 KB
実行使用メモリ 52,964 KB
最終ジャッジ日時 2024-04-25 21:36:10
合計ジャッジ時間 5,998 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
50,880 KB
testcase_01 AC 54 ms
50,692 KB
testcase_02 AC 55 ms
50,708 KB
testcase_03 AC 57 ms
50,592 KB
testcase_04 WA -
testcase_05 AC 55 ms
50,724 KB
testcase_06 WA -
testcase_07 AC 58 ms
50,772 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 60 ms
50,808 KB
testcase_11 WA -
testcase_12 AC 61 ms
50,720 KB
testcase_13 AC 57 ms
50,412 KB
testcase_14 AC 57 ms
50,660 KB
testcase_15 AC 58 ms
50,524 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 56 ms
50,816 KB
testcase_21 AC 54 ms
50,724 KB
testcase_22 AC 57 ms
50,856 KB
testcase_23 WA -
testcase_24 AC 56 ms
50,800 KB
testcase_25 AC 58 ms
50,632 KB
testcase_26 AC 59 ms
50,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder415 {

    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	Printer pr = new Printer(System.out);

    	int n = sc.nextInt();
    	int d = sc.nextInt();

    	if (n == 1 || n == d) {
    		pr.println(0);
    	} else if (n % d == 0) {
    		pr.println((n - 1) / d);
    	} else {
    		pr.println(n - 1);
    	}

    	pr.close();
        sc.close();
    }

	@SuppressWarnings("unused")
	private static class Scanner {
		BufferedReader br;
		Iterator<String> it;

		Scanner (InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}

		String next() throws RuntimeException  {
			try {
				if (it == null || !it.hasNext()) {
//					it = Arrays.asList(br.readLine().split(" ")).iterator();
					it = Arrays.asList(br.readLine().split("\\p{javaWhitespace}+")).iterator();
				}
				return it.next();
			} catch (IOException e) {
				throw new IllegalStateException();
			}
		}

		int nextInt() throws RuntimeException {
			return Integer.parseInt(next());
		}

		long nextLong() throws RuntimeException {
			return Long.parseLong(next());
		}

		float nextFloat() throws RuntimeException {
			return Float.parseFloat(next());
		}

		double nextDouble() throws RuntimeException {
			return Double.parseDouble(next());
		}

		void close() {
			try {
				br.close();
			} catch (IOException e) {
//				throw new IllegalStateException();
			}
		}
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0