洛谷 P1328 生活大爆炸版石头剪刀布 —— 模拟
题目:https://www.luogu.org/problemnew/show/P1328
直接模拟即可。
代码如下:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int const maxn=;
int n,la,lb,a[maxn],b[maxn],p[][],ansa,ansb;
void init()
{
p[][]=p[][]=; p[][]=p[][]=;
p[][]=p[][]=; p[][]=p[][]=;
p[][]=p[][]=; p[][]=p[][]=;
p[][]=p[][]=; p[][]=p[][]=;
p[][]=p[][]=; p[][]=p[][]=;
}
int main()
{
init();
scanf("%d%d%d",&n,&la,&lb);
for(int i=;i<=la;i++)scanf("%d",&a[i]);
for(int i=;i<=lb;i++)scanf("%d",&b[i]);
for(int i=,ta=,tb=;i<=n;i++)
{
ansa+=p[a[ta]][b[tb]]; ansb+=p[b[tb]][a[ta]];
ta++; tb++;
if(ta==la+)ta=; if(tb==lb+)tb=;
}
printf("%d %d\n",ansa,ansb);
return ;
}
洛谷 P1328 生活大爆炸版石头剪刀布 —— 模拟的更多相关文章
- 洛谷 P1328 生活大爆炸版石头剪刀布 模拟
很简单 Code: #include<cstdio> #include<queue> using namespace std; queue<int>A; queue ...
- 洛谷 P1328 生活大爆炸版石头剪刀布【模拟/环/周期】
题目描述 石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头.如果两个人出拳一样,则不分胜负.在<生活大爆炸>第二季第8 集中出现了一种石头剪刀布的升级版游戏. 升级版游戏在传统的 ...
- [NOIP2014] 提高组 洛谷P1328 生活大爆炸版石头剪刀布
题目描述 石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头.如果两个人出拳一样,则不分胜负.在<生活大爆炸>第二季第8 集中出现了一种石头剪刀布的升级版游戏. 升级版游戏在传统的 ...
- 洛谷P1328 生活大爆炸版石头剪刀布——S.B.S.
题目描述 石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头.如果两个人出拳一样,则不分胜负.在<生活大爆炸>第二季第8 集中出现了一种石头剪刀布的升级版游戏. 升级版游戏在传统的 ...
- 洛谷—— P1328 生活大爆炸版石头剪刀布
https://www.luogu.org/problem/show?pid=1328 题目描述 石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头.如果两个人出拳一样,则不分胜负.在< ...
- 洛谷P1328生活大爆炸版石头剪刀布
题目链接:https://www.luogu.org/problemnew/show/P1328
- Java实现 洛谷 P1328 生活大爆炸版石头剪刀布
import java.util.Scanner; public class Main{ private static int[] duel(int playerA, int playerB){ in ...
- 洛谷 1328 生活大爆炸版石头剪刀布(NOIp2014提高组)
[题解] 简单粗暴的模拟题. #include<cstdio> #include<algorithm> #include<cstring> #define LL l ...
- 模拟--P1328 生活大爆炸版石头剪刀布 题解
P1328 生活大爆炸版石头剪刀布 这也是打表么?? #include <iostream> using namespace std; static const auto y = []() ...
随机推荐
- Python中的列表(4)
1.遍历列表 如果想打印列表中的所有元素,则必须遍历列表. 可以使用for ... in ... 语句来遍历列表中的元素.遍历的意思 words = ['a','b','c','d'] for wor ...
- SQL-Redis使用详细教程
一.Redis基础部分: 1.redis介绍与安装比mysql快10倍以上 *****************redis适用场合**************** 1.取最新N个数据的操作 2.排行榜应 ...
- Inspector's Dilemma(欧拉通路)
In a country, there are a number of cities. Each pair of city is connected by a highway, bi-directio ...
- prometheus监控linux系统
安装node exporter 创建Systemd服务 #vim /etc/systemd/system/node_exporter.service[Unit]Description=mysql_ex ...
- fd最大值和限制
fd的数量决定了fd的最大值 在Linux下,系统全部能够打开的fd总数为: /proc/sys/fs/file-max,取决于内存 The file-max file /proc/sys/fs/fi ...
- HTML Imports & polyfill
组件化浏览器的兼容性问题汇总 框架依赖的 Web 标准技术 优先级高 HTML Imports HTML tempaltes ES6 to ES5 (搭建模块开发环境) polyfill https: ...
- HDU 2442
状态压缩DP , 和HDU2280极其相似 #include <cstdio> #include <cstring> #include <iostream> usi ...
- [BZOJ3555] [Ctsc2014]企鹅QQ(Hash)
传送门 可以枚举被删除的位置,然后用hash表判重,然而网上好多题解都是用 sort 判重的. 不知道为什么,int 总是过不了,换成 long long 或者是 unsigned long long ...
- hdu 1787
#include<stdio.h> #include<math.h> int huzhi(int n) {//欧拉函数公式 int i,j=n; for(i=2;i<(i ...
- 破损的键盘(codevs 4650)
题目描述 Description 有一天,你需要打一份文件,但是你的键盘坏了,上面的"home"键和"end"键会时不时地按下,而你却毫不知情,甚至你都懒得打开 ...