Skip to content

Instantly share code, notes, and snippets.

@HyeonWooKim
Created March 23, 2016 19:50
Show Gist options
  • Save HyeonWooKim/eac7b77766140ab455d1 to your computer and use it in GitHub Desktop.
Save HyeonWooKim/eac7b77766140ab455d1 to your computer and use it in GitHub Desktop.
유진수(BOJ 1356)
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
string a,b;
int len;
cin>>b;
len=b.length()-1;
for(int i=0;i<len;i++)
{
a+=b[0];
b.erase(b.begin());
int ap=1,bp=1;
for(int j=0;j<a.length();j++)ap*=(a[j]-'0');
for(int j=0;j<b.length();j++)bp*=(b[j]-'0');
if(ap==bp)
{
cout<<"YES\n";
return 0;
}
}
cout<<"NO\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment