728x90

๋ฌธ์ œ ์„ค๋ช…

์ •์ˆ˜ 2๊ฐœ(a, b)๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ a๋ฅผ 2b๋ฐฐ ๊ณฑํ•œ ๊ฐ’์œผ๋กœ ์ถœ๋ ฅํ•ด๋ณด์ž.
0 <= a <= 10, 0 <= b <= 10


์ฐธ๊ณ 
์˜ˆ๋ฅผ ๋“ค์–ด 1 3 ์ด ์ž…๋ ฅ๋˜๋ฉด 1์„ 2^3(8)๋ฐฐ ํ•˜์—ฌ ์ถœ๋ ฅํ•œ๋‹ค.

์˜ˆ์‹œ
int a=1, b=10;
printf("%d", a << b); //210 = 1024 ๊ฐ€ ์ถœ๋ ฅ๋œ๋‹ค.

์ž…๋ ฅ

์ •์ˆ˜ 2๊ฐœ๊ฐ€ ๊ณต๋ฐฑ์„ ๋‘๊ณ  ์ž…๋ ฅ๋œ๋‹ค.
0 <= a, b <= 10

 

์ถœ๋ ฅ

a ๋ฅผ 2^b๋ฐฐ ๋งŒํผ ๊ณฑํ•œ ๊ฐ’์„ ์ถœ๋ ฅํ•œ๋‹ค.

 

์ž…๋ ฅ ์˜ˆ์‹œ
1 3

์ถœ๋ ฅ ์˜ˆ์‹œ
8

๋ฌธ์ œ ํ’€์ด

#include <stdio.h>

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    printf("%d",a<<b);
    
    return 0;
}

+ Recent posts