AtCoder-abc147 (题解)
A - Blackjack (水题) 题目链接 大致思路: 水题 B - Palindrome-philia (水题) 题目链接 大致思路: 由于整个串是回文串,只要判断前一半和后一半有多少个不同即可 C - HonestOrUnkind2 (暴力) 题目链接 大致思路: \(N\) 只有15,直接枚举出所有的情况 \(2^N\) 种,对每一种方案判断合法性即可,只要找诚实的人来判断。 点击展开代码 #include<bits/stdc++.h> using namespace std; vector<int>x[20],y[20]; int n; int js(int x){ int ans=0; while(x){ ans+=(x&1); x>>=1; } return ans; } bool check(int X){ int temp[20]={0}; for(int i=1;i<=n;i++){ if((X>>(i-1))&1)temp[i]=1; else temp[i]=0; } for(int i=1;i<=n;i++){ if(temp[i]){ int siz=x[i].size(); for(int j=0;j<siz;j++){ int id=x[i][j]; if((temp[id]^y[i][j])==1)return 0; } } } return 1