标签:int img name 情况 bsp ble P20 namespace cdn
题意就不说了,算法也就是个大暴力,把每种情况输赢都预处理出来(打表就好了),注意一些细节就可以了。
上代码:
#include <iostream> using namespace std; int n, na, nb; int a[210], b[210]; int aa, ab; /* 1:平 2:赢 3:输 */ int cmp(int x, int y) { switch (x) { case 0: switch(y) { case 0: return 1; case 1: return 3; case 2: return 2; case 3: return 2; case 4: return 3; } case 1: switch(y) { case 0: return 2; case 1: return 1; case 2: return 3; case 3: return 2; case 4: return 3; } case 2: switch(y) { case 0: return 3; case 1: return 2; case 2: return 1; case 3: return 3; case 4: return 2; } case 3: switch(y) { case 0: return 3; case 1: return 3; case 2: return 2; case 3: return 1; case 4: return 2; } case 4: switch(y) { case 0: return 2; case 1: return 2; case 2: return 3; case 3: return 3; case 4: return 1; } } return 0; } int main() { cin >> n >> na >> nb; for (int i = 1; i <= na; i++) cin >> a[i]; for (int i = 1; i <= nb; i++) cin >> b[i]; a[0] = a[na]; b[0] = b[nb]; for (int i = 1; i <= n; i++) { if (cmp(a[i % na], b[i % nb]) == 1) { } else if (cmp(a[i % na], b[i % nb]) == 2) { aa++; } else { ab++; } } cout << aa << " " << ab; }
标签:int img name 情况 bsp ble P20 namespace cdn
原文地址:https://www.cnblogs.com/zcr-blog/p/11760815.html