2 条题解

  • 0
    @ 2024-10-23 10:35:53
    #include<bits/stdc++.h>
    #define ULL unsigned long long
    #define int long long
    #define endl '\n'
    #define debug(a) cout<<#a<<"="<<a<<endl;
    #define all(v) v.begin(), v.end()
    #define PII pair<int,int>
    using namespace std;
    constexpr int N =  1 *1e6 + 10,M = 5 * 1e3 + 10,inf = 0x3f3f3f3f;
    
    
    void solve()
    {
        string str;
        cin >> str;
        sort(all(str));
        str.erase(unique(all(str)),str.end());
        cout<<str.size()<<endl;
    }
    signed main()
    {
        ios::sync_with_stdio(0);cin.tie(nullptr),cout.tie(nullptr);
        int _=1;
        // cin>>_;
        while(_--)
        {
            solve();
        }
        return 0;
    }
    
    /**
     *    author: Nijika_jia
     *    created: 2024.10.23 10:33:03
     */
    
    • 0
      @ 2024-10-22 20:17:27

      参考答案:

      #include<iostream>
      #include<algorithm>
      #include<string>
      using namespace std;
      int b[1200];
      int main()
      {
          string a;
          int sum = 0;
          cin >> a;
          for (int i = 0; i < a.length(); ++i)
          {
              b[a[i]] = 1;
          }
          for (int i = 0; i < 1200; ++i)
          {
              if (b[i] != 0) ++sum;
          }
          cout << sum << '\n';
      
          return 0;
      }
      
      • 1

      信息

      ID
      5424
      时间
      1000ms
      内存
      256MiB
      难度
      1
      标签
      递交数
      4
      已通过
      3
      上传者