結果

問題 No.820 Power of Two
コンテスト
ユーザー heyanxx
提出日時 2019-07-03 15:01:03
言語 Java
(openjdk 26.0.2.1 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
TLE  
実行時間 -
コード長 891 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,396 ms
コンパイル使用メモリ 84,432 KB
実行使用メモリ 40,692 KB
最終ジャッジ日時 2026-08-27 19:55:05
合計ジャッジ時間 6,610 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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) {
		int c=0;
		for(int i=1;i<=Math.pow(2, a);i++) {
			if(i%Math.pow(2, b)==0) {
				c++;
			}
		}
	return c;
		
	}

}
0