记录编号 178047 评测结果 AAAAAAAAAA
题目名称 [NOIP 2014]生活大爆炸版石头剪刀布 最终得分 100
用户昵称 Gravatar啊吧啦吧啦吧 是否通过 通过
代码语言 C++ 运行时间 0.011 s
提交时间 2015-08-13 08:24:38 内存使用 0.31 MiB
显示代码纯文本
#include <iostream>
#include <fstream>

using namespace std;

ifstream fin("rps.in");
ofstream fout("rps.out");
#define cin fin
#define cout fout
const int MAXAB(201);
int n, na, nb, a = 0, b = 0;
short qa[MAXAB], qb[MAXAB];

main()
{
	int x, y;
	cin >> n >> na >> nb;
	for (int i = 1; i <= na; ++i)
		cin >> qa[i];
	for (int i = 1; i <= nb; ++i)
		cin >> qb[i];
	fin.close();
	
	for (int i = 1; i <= n; ++i){
		x = i % na;
		y = i % nb;
		if (x == 0)
			x = na;
		if (y == 0)
			y = nb;
		if (qa[x] == qb[y])
			continue;
		else if (qa[x] == 0 && qb[y] == 1)
			b++;
		else if (qa[x] == 1 && qb[y] == 0)
			a++;
		else if (qa[x] == 0 && qb[y] == 2)
			a++;
		else if (qa[x] == 2 && qb[y] == 0)
			b++;
		else if (qa[x] == 0 && qb[y] == 3)
			a++;
		else if (qa[x] == 3 && qb[y] == 0)
			b++;
		else if (qa[x] == 0 && qb[y] == 4)
			b++;
		else if (qa[x] == 4 && qb[y] == 0)
			a++;
		else if (qa[x] == 1 && qb[y] == 2)
			b++;
		else if (qa[x] == 2 && qb[y] == 1)
			a++;
		else if (qa[x] == 1 && qb[y] == 3)
			a++;
		else if (qa[x] == 3 && qb[y] == 1)
			b++;
		else if (qa[x] == 1 && qb[y] == 4)
			b++;
		else if (qa[x] == 4 && qb[y] == 1)
			a++;
		else if (qa[x] == 2 && qb[y] == 3)
			b++;
		else if (qa[x] == 3 && qb[y] == 2)
			a++;
		else if (qa[x] == 2 && qb[y] == 4)
			a++;
		else if (qa[x] == 4 && qb[y] == 2)
			b++;
		else if (qa[x] == 3 && qb[y] == 4)
			a++;
		else if (qa[x] == 4 && qb[y] == 3)
			b++;
	}
	
	cout << a << ' ' << b;
	fout.close();
//	for(;;);
}