๋ฌธ์
https://school.programmers.co.kr/learn/courses/30/lessons/12947
๋ด ํ์ด
#include <string>
#include <vector>
using namespace std;
bool solution(int x) {
bool answer = false;
int total = 0;
int tmp = x;
while(tmp > 0)
{
total += (tmp % 10);
tmp /= 10;
}
if(x % total == 0)
answer = true;
return answer;
}
'๐ฅ๏ธ Study Note > Coding Test' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ํ๋ก๊ทธ๋๋จธ์ค]level.3 - ๋ฉ๋ฆฌ ๋ฐ๊ธฐ(C++) (0) | 2023.06.23 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค]level.3 - ์๋ฌผ์ ์ ์ด์ (C++) (0) | 2023.06.21 |
[ํ๋ก๊ทธ๋๋จธ์ค]level.2 - ํ๋ฐฐ ์์(C++) (0) | 2023.06.19 |
[ํ๋ก๊ทธ๋๋จธ์ค]level.2 - ํธํ ๋์ค(C++) (0) | 2023.06.18 |
[ํ๋ก๊ทธ๋๋จธ์ค]level.2 - ์์ด ๋๋ง์๊ธฐ(C++) (0) | 2023.06.18 |