zoukankan      html  css  js  c++  java
  • 看不懂的代码

    #include <vector>
    #include <list>
    #include <map>
    #include <set>
    #include <queue>
    #include <deque>
    #include <stack>
    #include <bitset>
    #include <algorithm>
    #include <functional>
    #include <numeric>
    #include <utility>
    #include <sstream>
    #include <iostream>
    #include <iomanip>
    #include <cstdio>
    #include <cmath>
    #include <cstdlib>
    #include <ctime>

    using namespace std;

    typedef long long llint;
    typedef pair< int, int > par;
    #define x first
    #define y second

    class StringGame {
    public:
      int a[55][55];
      int ch[55], dead[55];

      vector <int> getWinningStrings( vector <string> S ) {
        vector< int > ans;
        int n = S.size();
        for( int i = 0; i < n; ++i )
          for( int j = 0; j < (int)S[i].size(); ++j )
            a[i][S[i][j]-'a']++;
        
        for( int i = 0; i < n; ++i ) {
          for( int j = 0; j < 55; ++j )
            ch[j] = dead[j] = 0;
          
          bool okk = true;
          for( int j = 0; j < 26; ++j ) {
            int z = -1;
            for( int k = 0; k < 26; ++k )
              if( !ch[k] ) {
                int ok = 1;
                for( int l = 0; l < n; ++l )
                  if( !dead[l] && a[l][k] > a[i][k] ) { ok = 0; break; }
                if( ok ) { z = k; break; }
              }
            if( z == -1 ) { okk = false; break; }
            for( int l = 0; l < n; ++l )
              if( a[l][z] < a[i][z] ) dead[l] = 1;
            ch[z] = 1;
          }
          
          for( int l = 0; l < n; ++l )
            if( l != i && !dead[l] ) okk = false;
          if( okk ) ans.push_back( i );
        }
        return ans;
      }
    };
  • 相关阅读:
    C++泛型函数及模版类
    android逆向入门及工具下载
    排序算法之交换排序
    索尼法则=?职场法则
    2014年5月20日---一个值得纪念的日子
    C#的委托是什么?
    物联网RFID安全研究
    [转]nmap使用方法
    [转]中间人攻击-ARP毒化
    15019:Only the instance admin may alter the PermSize attribute
  • 原文地址:https://www.cnblogs.com/zhangdashuai/p/3702179.html
Copyright © 2011-2022 走看看