AtCoder Beginner Contest 054(ABCD)

A - One Card Poker

思路:特判即可。

B - Template Matching

思路:模拟注意下细节即可。

C - One-stroke Path

我的思路:暴力位运算枚举然后特判下。

更简单的思路: d f s dfs dfs爆搜。

void dfs(int u,int s){
if(s==n){
ans++;return;
}
vis[u]=1;
for(int v:e[u]){
if(!vis[v]) dfs(v,s+1);
}
vis[u]=0;
}

D - Mixing Experiment

思路:典型的背包问题,直接二维分别为 A , B A,B A,B的容量即可。