eolymp
bolt
Try our new interface for solving problems
Problems

Трицифрове число

published at 2/12/24, 7:35:00 pm

void solve() { ll n; cin>>n; ll a=n/100; ll b=n/10%10; ll c=n%10; if(((((a!=b and b!=c and a!=c) and c!=0)) and a!=0) and b!=0){ cout<<6; } else if(((((a!=b and b==c) or (a==b and b!=c) or (a==b and a!=c)) and c!=0) and a!=0) and b!=0){ cout<<3; } else if(((c==0 and a==b) and a!=0) and b!=0){ cout<<2; } else if(((c==0 and a!=b)and a!=0) and b!=0){ cout<<4; } else if(((b==0 and a==c)and c!=0) and a!=0){ cout<<2; } else if(((b==0 and a!=c)and a!=0) and c!=0){ cout<<4; } else if((b==0 and c==0 and a!=b and a!=c) or (a==b and b==c)){ cout<<1; } else if(a==c and c!=b){ cout<<2; } } int main() { // ll t; // cin >>t; // while(t--) // { solve(); // } time;

}

published at 2/21/24, 7:46:39 pm

include <bits/stdc++.h>

define ll long long int

define ld long double

using namespace std; int main(){

ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n;
cin>>n;
ll x, y, z;
x = n/100;
y = n/10%10;
z = n%10;
set<ll>s;
s.insert(x);
s.insert(y);
s.insert(z);
if(s.size() == 1){
    cout<<1;
}
else if(s.size() == 2){
    if(n == 100 || n == 200 || n == 300 || n == 400 || n == 500 || n == 600 || n == 700 || n == 800 || n == 900){
        cout<<1;
        return 0;
    }
    if(s.count(0) > 0){
        cout<<2;
    }
    else{
        cout<<3;
    }
}
else{
    if(s.count(0) > 0){
        cout<<4;
    }
    else{
        cout<<6;
    }
}

} //TECHNOBLADE NEVER DIES