웅재의 코딩세상
[프로그래머스] 세균 증식 본문
- 내 풀이
#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;
}
쉬프트 연산 사용!!
반응형
'코딩테스트 > 프로그래머스 - LV 0' 카테고리의 다른 글
[프로그래머스] 진료 순서 정하기 (0) | 2024.01.05 |
---|---|
[프로그래머스] 문자열, 조건문, 수학, 반복문 (0) | 2024.01.05 |
[프로그래머스] 모음 제거 (3) | 2024.01.04 |
[프로그래머스] 문자열, 반복문, 출력, 배열, 조건문 (0) | 2024.01.04 |
[프로그래머스] 수학, 배열2 (1) | 2024.01.04 |