結果

問題 No.46 はじめのn歩
ユーザー 水野嶺水野嶺
提出日時 2020-05-14 14:02:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 562 bytes
コンパイル時間 2,740 ms
コンパイル使用メモリ 71,928 KB
実行使用メモリ 56,220 KB
最終ジャッジ日時 2023-10-13 08:31:46
合計ジャッジ時間 4,678 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,864 KB
testcase_01 AC 124 ms
56,092 KB
testcase_02 AC 125 ms
55,648 KB
testcase_03 AC 124 ms
55,716 KB
testcase_04 AC 124 ms
56,220 KB
testcase_05 AC 124 ms
55,660 KB
testcase_06 AC 124 ms
55,960 KB
testcase_07 AC 123 ms
55,904 KB
testcase_08 AC 124 ms
56,128 KB
testcase_09 AC 125 ms
55,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		//商
		int n = b / a;
		//余あまり
		int m = b % a;
		
		//あまりの有無で条件分岐
		//余りがない場合
		if(m == 0){
		System.out.println(n);
		
		//余りあり
		}else{
		System.out.println(n + 1);
		}
		
	}
}
0