Advertisement
Josif_tepe

Untitled

Mar 22nd, 2024
539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4. #include <set>
  5. using namespace std;
  6. typedef long long ll;
  7.  
  8.  
  9.  
  10. int main() {
  11.     int n;
  12.     cin >> n;
  13.    
  14.     vector<int> cnt(10, 0);
  15.     while(n > 0) {
  16.         int cifra = n % 10;
  17.         cnt[cifra]++;
  18.         n /= 10;
  19.     }
  20.     int res = 0;
  21.     for(int i = 100; i <= 999; i++) {
  22.         vector<int> tmp(10, 0);
  23.         int t = i;
  24.         while(t > 0) {
  25.             int cifra = t % 10;
  26.             tmp[cifra]++;
  27.             t /= 10;
  28.         }
  29.         if(cnt == tmp) {
  30.             res++;
  31.         }
  32.     }
  33.     cout << res << endl;
  34.    
  35.     return 0;
  36. }
  37. //   2 1 3 3
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement