웅재의 코딩세상

[프로그래머스] 세균 증식 본문

코딩테스트/프로그래머스 - LV 0

[프로그래머스] 세균 증식

웅드 2024. 1. 4. 17:11
  • 내 풀이
#include <string>
#include <vector>
#include <cmath>

using namespace std;

int solution(int n, int t) {
    return n*pow(2,t);
}
  • 다른사람 풀이
#include <string>
#include <vector>
using namespace std;
int solution(int n, int t) {
    return n << t;
}

쉬프트 연산 사용!!

반응형