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;
      }
    };
  • 相关阅读:
    S5P4418iNand清空方法
    使用 GIT 获得Linux Kernel的代码并查看,追踪历史记录
    Linux3.4内核的基本配置和编译
    uboot---linux
    TestNG的简单使用
    java selenium webdriver处理JS操作窗口滚动条
    testNG入门详解
    零成本实现接口自动化测试 – Java+TestNG 测试Restful service
    Selenium Webdriver——操作隐藏的元素(二)display属性
    python selenium webdriver处理浏览器滚动条
  • 原文地址:https://www.cnblogs.com/zhangdashuai/p/3702179.html
Copyright © 2011-2022 走看看