生活大爆炸版剪刀石头布
import java.io.IOException; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int na = sc.nextInt(); int nb = sc.nextInt(); int Na[] = new int[na]; int Nb[] = new int[nb]; int f[][]= {{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}}; for (int i = 0; i < na; i++) { Na[i] = sc.nextInt(); } for (int i = 0; i < nb; i++) { Nb[i] = sc.nextInt(); } int counta = 0,countb = 0; for (int i = 0; i < n; i++) { if(f[Na[i % na]][Nb[i % nb]] > 0)counta++; else if (f[Na[i % na]][Nb[i % nb]] < 0) countb++; } System.out.println(counta + " " + countb); } }