标签:
一个”o”到最右端的时候消失。问谁获胜。
#include <bits/stdc++.h>
using namespace std;
const int N = 20;
int d[(1 << N) + 10];
class EllysCheckers {
public:
string getWinner(string board) {
int n = board.size();
int t = 0;
for (int i = 0; i < n; ++i) {
if (board[i] == ‘o‘) t += n - i - 1;
}
return t & 1 ? "YES" : "NO";
}
};
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef long long LL;
typedef pair<int, int> pii;
int p[20];
const int N = 505;
LL a[N];
vector<int> b;
map<LL, LL> dp;
map<LL, LL>:: iterator it;
class EllysNumbers {
public:
long long getSubsets(long long n, vector <string> special) {
string s = accumulate(special.begin(), special.end(), string());
istringstream ss(s);
int m = 0, x;
while (ss >> x) a[m++] = x;
for (int i = 0; i < m; ++i)
if (__gcd(a[i], n / a[i]) == 1) b.pb(a[i]);
dp[n] = 1;
for (int i = 0; i < b.size(); ++i)
for (it = dp.begin(); it != dp.end(); it++)
if (it -> F % b[i] == 0) {
dp[it -> F / b[i]] += it -> S;
}
return dp[1];
}
};
标签:
原文地址:http://www.cnblogs.com/yxwkf/p/5194845.html