其他分享
首页 > 其他分享> > P1328-生活大爆炸版石头剪刀布

P1328-生活大爆炸版石头剪刀布

作者:互联网

 1 #include <bits/stdc++.h>
 2 #define _for(i,a,b) for(int i = (a);i < b;i ++)
 3 #define _rep(i,a,b) for(int i = (a);i > b;i --)
 4 typedef long long ll;
 5 using namespace std;
 6 inline ll read()
 7 {
 8     ll ans = 0;
 9     char ch = getchar(), last = ' ';
10     while(!isdigit(ch)) last = ch, ch = getchar();
11     while(isdigit(ch)) ans = (ans << 1) + (ans << 3) + ch - '0', ch = getchar();
12     if(last == '-') ans = -ans;
13     return ans;
14 }
15 inline void write(ll x)
16 {
17     if(x < 0) x = -x, putchar('-');
18     if(x >= 10) write(x / 10);
19     putchar(x % 10 + '0');
20 }
21 
22 int N,Na,Nb;
23 int a[203];
24 int b[203];
25 int rnta = 0;
26 int rntb = 0;
27 int goal[][5] = {{0,-1,1,1,-1},{1,0,-1,1,-1},{-1,1,0,-1,1},{-1,-1,1,0,1},{1,1,-1,-1,0}};
28 int main()
29 {
30     N = read(), Na = read(), Nb = read();
31     _for(i,0,Na)
32         a[i] = read();
33     _for(i,0,Nb)
34         b[i] = read();
35     
36     _for(i,0,N)
37     {
38         if(!goal[a[i%Na]][b[i%Nb]])
39             continue;
40         else if(1==goal[a[i%Na]][b[i%Nb]])
41             rnta ++;
42         else 
43             rntb ++; 
44     }
45     printf("%d %d\n",rnta,rntb);
46     return 0;
47 }

 

标签:ch,爆炸,Na,Nb,int,read,P1328,剪刀,i%
来源: https://www.cnblogs.com/Asurudo/p/11375397.html