관리 메뉴

NineTwo meet you

[CodeUp/자바] 1048 : [기초-비트시프트연산] 한 번에 2의 거듭제곱 배로 출력하기(설명) 본문

프로그래밍 문제/CodeUp

[CodeUp/자바] 1048 : [기초-비트시프트연산] 한 번에 2의 거듭제곱 배로 출력하기(설명)

NineTwo 2020. 12. 20. 16:55
반응형

출처


코드

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class CodeUp1048 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String num[] = br.readLine().split(" ");
int a = Integer.parseInt(num[0]);
int b = Integer.parseInt(num[1]);
System.out.print(a*(int)Math.pow(2, b));
}
}
view raw CodeUp1048.java hosted with ❤ by GitHub
반응형
Comments