結果

問題 No.415 ぴょん
ユーザー GrenacheGrenache
提出日時 2016-08-26 22:42:07
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,583 bytes
コンパイル時間 3,847 ms
コンパイル使用メモリ 78,872 KB
実行使用メモリ 52,924 KB
最終ジャッジ日時 2024-04-25 21:36:46
合計ジャッジ時間 6,424 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
50,828 KB
testcase_01 AC 63 ms
50,900 KB
testcase_02 AC 61 ms
50,848 KB
testcase_03 AC 62 ms
50,916 KB
testcase_04 WA -
testcase_05 AC 61 ms
50,684 KB
testcase_06 WA -
testcase_07 AC 61 ms
50,544 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 61 ms
51,004 KB
testcase_11 WA -
testcase_12 AC 61 ms
50,560 KB
testcase_13 AC 65 ms
50,820 KB
testcase_14 AC 62 ms
50,712 KB
testcase_15 AC 61 ms
50,536 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 62 ms
50,636 KB
testcase_21 AC 67 ms
51,016 KB
testcase_22 AC 62 ms
50,544 KB
testcase_23 WA -
testcase_24 AC 62 ms
50,792 KB
testcase_25 AC 60 ms
51,012 KB
testcase_26 AC 61 ms
50,660 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 (d != 1 && 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