
이미 다 작성된 코드에 if문만 내가 작성한거임.
while문으로 저렇게 박수 횟수를 구할 생각을 못했을거 같음
public int solution(int number) {
int count = 0;
for (int i = 1; i <= number; i++) {
int current = i;
int temp = count;
while (current != 0) {
if (current % 10 == 3 || current % 10 == 6 || current % 10 == 9){
count++;
}
current /= 10;
}
}
return count;'알고리즘 > 이것저것' 카테고리의 다른 글
| 팰린드롬 판단하기 (0) | 2022.03.12 |
|---|---|
| [python] 효율적인 소수 판별 (0) | 2020.07.20 |
| [Python] 소수 판별 (0) | 2020.07.20 |
| [Python] 소인수분해 (0) | 2020.07.20 |
| [Python] n번째 소수 찾기 (0) | 2020.07.20 |