luogu P1328 生活大爆炸 模拟
#include <cstdio> using namespace std; int n,na,nb; int mp[5][5]{{0,0,1,1,0},{1,0,0,1,0},{0,1,0,0,1},{0,0,1,0,1},{1,1,0,0,0}}; int vec[3][250],ans[3]; int main() { scanf("%d%d%d",&n,&na,&nb); for (int i = 0;i < na;i++) scanf("%d",&vec[1][i]); for (int i = 0;i < nb;i++) scanf("%d",&vec[2][i]); for (int i = 0;i < n;i++) { int a = vec[1][i % na],b = vec[2][i % nb]; ans[1] += mp[a][b]; ans[2] += mp[b][a]; } printf("%d %d\n",ans[1],ans[2]); return 0; }
心之所动 且就随缘去吧