题目链接
https://www.luogu.com.cn/problem/P1328
题目分析
是一道和环有关的问题,直接模拟即可
AC代码
// Problem: P1328 [NOIP2014 提高组] 生活大爆炸版石头剪刀布
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P1328
// Memory Limit: 125 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include <iostream>
const int MXN = 205;
int n, an, bn, cnta, cntb;
int w[5][5] = {{2, 0, 1, 1, 0}, {1, 2, 0, 1, 0}, {0, 1, 2, 0, 1}, {0, 0, 1, 2, 1}, {1, 1, 0, 0, 2}};
int A[MXN], B[MXN];
int main()
{
std::cin >> n >> an >> bn;
for (int i = 0; i < an; ++ i) std::cin >> A[i];
for (int i = 0; i < bn; ++ i) std::cin >> B[i];
for (int i = 0; i < n; ++ i)
{
if (w[A[i % an]][B[i % bn]] == 1) cnta ++ ;
if (w[A[i % an]][B[i % bn]] == 0)cntb ++ ;
}
std::cout << cnta << ' ' << cntb;
}
标签:std,NOIP2014,int,bn,++,https,P1328,刷题
From: https://www.cnblogs.com/ClockParadox43/p/17471713.html