Задачи
Стойкое число
Расслабляющее какое-то задание...
JUST WANT TO DO
/****Author: Mahammad Mammadov ****/
include<bits/stdc++.h>
define ll long long
define nl '\n'
define pb push_back
define PI 3.14159265358979323846
define imm INT_MAX
define im INT_MIN
define ull unsigned long long
using namespace std; /*FUNCTIONS/ /****/ mt19937 rng(chrono::steadyclock::now().timesince_epoch().count());
ll productOfDigits(ll num) {
ll product = 1;
while (num > 0) {
ll digit = num % 10;
product *= digit;
num /= 10;
}
return product;
}
ll findPersistence(ll n) {
ll persistence = 0;
while (n >= 10) { n = productOfDigits(n); persistence++; } return persistence; }
void solve()
{
ll i,n,j,m,k,say=0,cem=0,maks=im,minu=imm;
while(cin>>n)
{
cout<<findPersistence(n)<<nl;
}
}
/*MAIN CODE/
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
int t=1;
//cin>>t;
while(t--)
{
solve();
}
return 0;
}
/(~~
)*/