結果

問題 No.820 Power of Two
ユーザー heyanxxheyanxx
提出日時 2019-07-03 15:07:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 857 bytes
コンパイル時間 3,177 ms
コンパイル使用メモリ 71,652 KB
実行使用メモリ 49,668 KB
最終ジャッジ日時 2023-10-13 10:10:20
合計ジャッジ時間 4,454 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,304 KB
testcase_01 AC 42 ms
49,232 KB
testcase_02 AC 42 ms
49,268 KB
testcase_03 AC 43 ms
49,668 KB
testcase_04 AC 43 ms
49,292 KB
testcase_05 AC 43 ms
49,256 KB
testcase_06 AC 43 ms
49,248 KB
testcase_07 AC 43 ms
49,316 KB
testcase_08 AC 42 ms
49,336 KB
testcase_09 AC 42 ms
49,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package test.demo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

public class YukicoderN820 {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		try {
			String str=bf.readLine();
			
			String[] str2=str.split(" ");
			if(str2.length==2) {
			int a=Integer.parseInt(str2[0]);
			int b=Integer.parseInt(str2[1]);

			System.out.println(new YukicoderN820().test(a,b));
			}else {
				throw new IOException();
			}
			
			return;
		} catch (IOException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
		

	}
	public int test(int a,int b) {
		if(a<b) {
			return 0;
		}else {
			return (int) Math.pow(2, a-b);
		}

		
	}

}
0