import java.util.Scanner;

public class Main{
private static int[] duel(int playerA, int playerB){
int[] result = new int[2];
if (playerA == 0){
if (playerB == 1) result[1] = 1;
if (playerB == 2) result[0] = 1;
if (playerB == 3) result[0] = 1;
if (playerB == 4) result[1] = 1;
} else if (playerA == 1){
if (playerB == 0) result[0] = 1;
if (playerB == 2) result[1] = 1;
if (playerB == 3) result[0] = 1;
if (playerB == 4) result[1] = 1;
} else if (playerA == 2){
if (playerB == 0) result[1] = 1;
if (playerB == 1) result[0] = 1;
if (playerB == 3) result[1] = 1;
if (playerB == 4) result[0] = 1;
} else if (playerA == 3){
if (playerB == 0) result[1] = 1;
if (playerB == 1) result[1] = 1;
if (playerB == 2) result[0] = 1;
if (playerB == 4) result[0] = 1;
} else if (playerA == 4){
if (playerB == 0) result[0] = 1;
if (playerB == 1) result[0] = 1;
if (playerB == 2) result[1] = 1;
if (playerB == 3) result[1] = 1;
}
return result;
} public static void main(String[] args){
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int nA = input.nextInt();
int nB = input.nextInt();
int[] a = new int[nA];
int[] b = new int[nB];
for (int i = 0; i < nA; i++){
a[i] = input.nextInt();
}
for (int i = 0; i < nB; i++){
b[i] = input.nextInt();
}
int countA = 0;
int countB = 0;
for (int i = 0; i < n; i++){
countA = countA + duel(a[i % nA], b[i % nB])[0];
countB = countB + duel(a[i % nA], b[i % nB])[1];
}
System.out.println(countA + " " + countB);
}
}

Java实现 洛谷 P1328 生活大爆炸版石头剪刀布的更多相关文章

  1. 洛谷P1328 生活大爆炸版石头剪刀布——S.B.S.

    题目描述 石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头.如果两个人出拳一样,则不分胜负.在<生活大爆炸>第二季第8 集中出现了一种石头剪刀布的升级版游戏. 升级版游戏在传统的 ...

  2. [NOIP2014] 提高组 洛谷P1328 生活大爆炸版石头剪刀布

    题目描述 石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头.如果两个人出拳一样,则不分胜负.在<生活大爆炸>第二季第8 集中出现了一种石头剪刀布的升级版游戏. 升级版游戏在传统的 ...

  3. 洛谷 P1328 生活大爆炸版石头剪刀布【模拟/环/周期】

    题目描述 石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头.如果两个人出拳一样,则不分胜负.在<生活大爆炸>第二季第8 集中出现了一种石头剪刀布的升级版游戏. 升级版游戏在传统的 ...

  4. 洛谷—— P1328 生活大爆炸版石头剪刀布

    https://www.luogu.org/problem/show?pid=1328 题目描述 石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头.如果两个人出拳一样,则不分胜负.在< ...

  5. 洛谷P1328生活大爆炸版石头剪刀布

    题目链接:https://www.luogu.org/problemnew/show/P1328

  6. 洛谷 P1328 生活大爆炸版石头剪刀布 —— 模拟

    题目:https://www.luogu.org/problemnew/show/P1328 直接模拟即可. 代码如下: #include<iostream> #include<cs ...

  7. 洛谷 P1328 生活大爆炸版石头剪刀布 模拟

    很简单 Code: #include<cstdio> #include<queue> using namespace std; queue<int>A; queue ...

  8. 洛谷 1328 生活大爆炸版石头剪刀布(NOIp2014提高组)

    [题解] 简单粗暴的模拟题. #include<cstdio> #include<algorithm> #include<cstring> #define LL l ...

  9. 模拟--P1328 生活大爆炸版石头剪刀布 题解

    P1328 生活大爆炸版石头剪刀布 这也是打表么?? #include <iostream> using namespace std; static const auto y = []() ...

随机推荐

  1. vscode+eslint自动格式化vue代码的方法

    前言 使用vscode开发vue项目的时候,为了编码格式的统一化,使用eslint规范进行格式化.此时通过eslint插件可以实现对vue代码的自动格式化. 使用方式 在vscode的插件模块处,搜索 ...

  2. 接口testing需要的技能

    1.什么是接口测试? 定义:测试系统组件间接口的一种测试.主要用于检测外部系统与系统之间以及内部各个子系统之间的交互点,重点是检查数据的交换,传递和控制管理过程,以及系统间的相互逻辑依赖关系等: 目的 ...

  3. 你 MySQL 中重复数据多吗,教你一招优雅的处理掉它们!

    在需要保证数据唯一性的场景中,个人觉得任何使用程序逻辑的重复校验都是不可靠的,这时只能在数据存储层做唯一性校验.MySQL 中以唯一键保证数据的唯一性,那么若新插入重复数据时,我们可以让 MySQL ...

  4. linux常用命令---centOS7的管理服务(针对yum安装的)

    centOS7的管理服务(针对yum安装的)

  5. Python 图像处理 OpenCV (3):图像属性、图像感兴趣 ROI 区域及通道处理

    前文传送门: 「Python 图像处理 OpenCV (1):入门」 「Python 图像处理 OpenCV (2):像素处理与 Numpy 操作以及 Matplotlib 显示图像」 图像属性 图像 ...

  6. mysql小白系列_04 binlog(未完)

    mysql打开.查看.清理binlog 1.开启日志 log_bin=/var/lib/mysql/mysql-bin mysql> show variables like '%log_bin% ...

  7. js倒计时 手机休眠时 时间不进行减少

    http://www.111cn.net/wy/js-ajax/94218.htm 手机版网页js倒计时存在的问题与解决的方法 www.111cn.net 更新:2015-09-16 编辑:kp123 ...

  8. poj 2296

    Map Labeler Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2047   Accepted: 682 Descri ...

  9. Java 面向对象基础

    面向对象的基础 局部变量和成员变量区别: 1)定义的位置不同    成员变量直接定义在class中    局部变量在某个{}中或者再某个方法中 2)在内存中的位置不同    对象的成员变量会在内存中的 ...

  10. 有点干货 | Jdk1.8新特性实战篇(41个案例)

    作者:小傅哥 博客:https://bugstack.cn - 汇总系列原创专题文章 沉淀.分享.成长,让自己和他人都能有所收获!