Algorithm 🧑🏻💻/백준(BOJ)
[백준,c++] 1356번 - 유진 수
dkswnkk
2021. 11. 4. 22:55
1356번: 유진수
첫째 줄에 수 N이 주어진다. 이 수는 2,147,483,647보다 작거나 같은 자연수이다.
www.acmicpc.net
#include <iostream>
#include <string>
using namespace std;
bool check;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
string N; cin >> N;
int tempLeft = 1;
for (int i = 0; i < N.length()-1; i++) {
int tempRight = 1;
tempLeft *= (N[i]-'0');
for (int k = i + 1; k < N.length(); k++) {
tempRight *= (N[k] - '0');
}
if (tempLeft == tempRight) {
check = true;
break;
}
}
if (check) cout << "YES";
else cout << "NO";
}