結果

問題 No.48 ロボットの操縦
ユーザー 水野嶺水野嶺
提出日時 2020-05-25 14:09:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 146 ms / 5,000 ms
コード長 557 bytes
コンパイル時間 2,729 ms
コンパイル使用メモリ 74,188 KB
実行使用メモリ 41,436 KB
最終ジャッジ日時 2024-04-21 03:43:36
合計ジャッジ時間 6,653 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
41,236 KB
testcase_01 AC 136 ms
41,000 KB
testcase_02 AC 134 ms
41,292 KB
testcase_03 AC 131 ms
41,016 KB
testcase_04 AC 131 ms
41,008 KB
testcase_05 AC 131 ms
41,272 KB
testcase_06 AC 137 ms
41,032 KB
testcase_07 AC 121 ms
39,984 KB
testcase_08 AC 131 ms
41,436 KB
testcase_09 AC 131 ms
41,180 KB
testcase_10 AC 128 ms
41,212 KB
testcase_11 AC 130 ms
41,164 KB
testcase_12 AC 139 ms
41,284 KB
testcase_13 AC 146 ms
41,272 KB
testcase_14 AC 123 ms
40,148 KB
testcase_15 AC 121 ms
39,712 KB
testcase_16 AC 129 ms
40,824 KB
testcase_17 AC 136 ms
40,832 KB
testcase_18 AC 134 ms
41,356 KB
testcase_19 AC 134 ms
40,944 KB
testcase_20 AC 142 ms
41,316 KB
testcase_21 AC 138 ms
41,144 KB
testcase_22 AC 139 ms
41,124 KB
testcase_23 AC 133 ms
41,072 KB
testcase_24 AC 133 ms
40,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main
{
	public static void main (String[] args) 
	{
		// 入力値の読み込み
		Scanner sc = new Scanner(System.in);
		int  x = sc.nextInt();
		int  y = sc.nextInt();
		int  n = sc.nextInt();
		int count=0;
		
		if(y < 0){
			count = 2;
		}else{
			if(!(x ==0)){
				count = 1;
			}
		}
		int xa = x/n;
		int xb = Math.abs(xa);
		if(!(x%n == 0)){
			xb += 1;
		}
		
		int ya = y/n;
		int yb = Math.abs(ya);
		if(!(y%n == 0)){
			yb += 1;
		}
		
		System.out.println(count + xb + yb);
	}
}
0