[luoguP1328] 生活大爆炸版石头剪刀布(模拟)
2024-09-04 16:32:09
虽然是模拟,但是我们可以用矩阵保存结果,来是其更加简便。
——代码
#include <cstdio>
#include <iostream> int map[][] = {{, , , , },
{, , , , },
{, , , , },
{, , , , },
{, , , , }};
int n, x, y, ans1, ans2;
int a[], b[]; inline int read()
{
int x = , f = ;
char ch = getchar();
for(; !isdigit(ch); ch = getchar()) if(ch == '-') f = -;
for(; isdigit(ch); ch = getchar()) x = (x << ) + (x << ) + ch - '';
return x * f;
} int main()
{
int i, j;
n = read();
x = read();
y = read();
for(i = ; i < x; i++) a[i] = read();
for(i = ; i < y; i++) b[i] = read();
i = ;
j = ;
while(n--)
{
ans1 += map[a[i]][b[j]];
ans2 += map[b[j]][a[i]];
i = (++i) % x;
j = (++j) % y;
}
printf("%d %d\n", ans1, ans2);
return ;
}
最新文章
- jsp原理
- R笔记 map_leaflet googlevis
- [reprint]如何编写引导程序 Hello World
- Django中级篇(上)
- PHP 有关上传图片时返回HTTP 500错误
- ios开发之IBOutlet和IBAction的区别
- OD: Kernel Exploit - 2 Programming
- Android 使用Post方式提交数据(登录)
- CSS技巧和经验列表
- Android中文API (110) —— CursorTreeAdapter
- linux中probe函数传递参数的寻找(下)
- 年月日时分秒毫秒+随机数getSerialNum
- 论文笔记系列-Simple And Efficient Architecture Search For Neural Networks
- numpy.newaxis()
- cocos2d-x JS 计算赋值时出现 NaN
- 利用cookie存放模糊查询的信息
- python 的print和特殊方法 __str__和__repr__
- 怎么选择软件许可证,Apache, MIT, BSD, GPL, Mozilla, LGPL
- 使用yii AR 完成单个表的CURD操作
- 优步uber司机不能绑定银行卡问题
热门文章
- 题解报告:hdu 2546 饭卡(01背包)
- MyEclipse配置Tomcat
- FileStream和BinaryReader,BinaryWriter,StreamReader,StreamWriter的区别
- [转]Monkey测试简介
- android开发学习——android studio 引入第三方库的总结
- 外文翻译 《How we decide》 Introduction
- mui 时间日期控件(浏览器上无法查看,在手机端可以点击)
- Farseer.net轻量级开源框架 中级篇:BasePage、BaseController、BaseHandler、BaseMasterPage、BaseControls基类使用
- WOJ600——水题
- ssh设置免秘钥登录