Java实现 洛谷 P1328 生活大爆炸版石头剪刀布.docx

上传人:Lun****ng 文档编号:143863484 上传时间:2020-09-02 格式:DOCX 页数:3 大小:312.67KB
返回 下载 相关 举报
Java实现 洛谷 P1328 生活大爆炸版石头剪刀布.docx_第1页
第1页 / 共3页
Java实现 洛谷 P1328 生活大爆炸版石头剪刀布.docx_第2页
第2页 / 共3页
Java实现 洛谷 P1328 生活大爆炸版石头剪刀布.docx_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

《Java实现 洛谷 P1328 生活大爆炸版石头剪刀布.docx》由会员分享,可在线阅读,更多相关《Java实现 洛谷 P1328 生活大爆炸版石头剪刀布.docx(3页珍藏版)》请在金锄头文库上搜索。

1、Java实现 洛谷 P1328 生活大爆炸版石头剪刀布import java.util.Scanner;public class Main private static int duel(int playerA, int playerB) int result = new int2; if (playerA = 0) if (playerB = 1) result1 = 1; if (playerB = 2) result0 = 1; if (playerB = 3) result0 = 1; if (playerB = 4) result1 = 1; else if (playerA = 1

2、) if (playerB = 0) result0 = 1; if (playerB = 2) result1 = 1; if (playerB = 3) result0 = 1; if (playerB = 4) result1 = 1; else if (playerA = 2) if (playerB = 0) result1 = 1; if (playerB = 1) result0 = 1; if (playerB = 3) result1 = 1; if (playerB = 4) result0 = 1; else if (playerA = 3) if (playerB =

3、0) result1 = 1; if (playerB = 1) result1 = 1; if (playerB = 2) result0 = 1; if (playerB = 4) result0 = 1; else if (playerA = 4) if (playerB = 0) result0 = 1; if (playerB = 1) result0 = 1; if (playerB = 2) result1 = 1; if (playerB = 3) result1 = 1; return result; public static void main(String args)

4、Scanner input = new Scanner(System.in); int n = input.nextInt(); int nA = input.nextInt(); int nB = input.nextInt(); int a = new intnA; int b = new intnB; for (int i = 0; i nA; i+) ai = input.nextInt(); for (int i = 0; i nB; i+) bi = input.nextInt(); int countA = 0; int countB = 0; for (int i = 0; i n; i+) countA = countA + duel(ai % nA, bi % nB)0; countB = countB + duel(ai % nA, bi % nB)1; System.out.println(countA + + countB);

展开阅读全文
相关资源
相关搜索

当前位置:首页 > IT计算机/网络 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号