http://acm.hdu.edu.cn/showproblem.php?pid=2164 Problem Description Rock, Paper, Scissors is a two player game, where each player simultaneously chooses one of the three items after counting to three. The game typically lasts a pre-determined number o…
Problem Description Rock, Paper, Scissors is a two player game, where each player simultaneously chooses one of the three items after counting to three. The game typically lasts a pre-determined number of rounds. The player who wins the most rounds w…
2018 ACM-ICPC 中国大学生程序设计竞赛线上赛:https://www.jisuanke.com/contest/1227 题目链接:https://nanti.jisuanke.com/t/26219 Rock Paper Scissors Lizard Spock Description: Didi is a curious baby. One day, she finds a curious game, which named Rock Paper Scissors Lizard…
就是改成把一个字符串改成三进制状压,然后分成前5位,后5位统计, 然后直接统计 f[i][j][k]代表,后5局状压为k的,前5局比和j状态比输了5局的有多少个人 复杂度是O(T*30000*25*m)m比较小,也就最多几十吧,将将过 #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> #include <cstdlib> #include &…
题目链接:https://vjudge.net/problem/Gym-101667H 题目大意:首先给你两个字符串,R代表石头,P代表布,S代表剪刀,第一个字符串代表第一个人每一次出的类型,第二个字符串代表第二个人每一次出的类型,问怎么控制第二个人开始的地方,能使得第二个人获胜的几率最大,然后输出最多获胜的局数. 具体思路:FFT,我们首先把第二个字符串每一个类型全部转换成他的对立面,比如说石头就转换成布,布就转换成剪刀,剪刀就转换成石头,然后我们就直接用第二个字符串去匹配就可以了. 匹配的时…
Gym - 101667H:https://vjudge.net/problem/Gym-101667H 参考:https://blog.csdn.net/weixin_37517391/article/details/80154299 题意: 已知两个人出剪刀石头布的顺序,第二个人可以选择从第一个人的任意手开始正式比赛,问第二个人赢得个数最多是多少. 思路: 首先肯定要把第二个人所代表的字符串T转化为对应能赢的字符串rT.这时候暴力的话就是把rT拿去和第一个人的字符串匹配. 这里就可以用FFT…
将第二个字符串改成能赢对方时对方的字符并倒序后,字符串匹配就是卷积的过程. 那么就枚举字符做三次卷积即可. #include <bits/stdc++.h> struct Complex { double r, i; Complex(){} Complex(double r, double i): r(r), i(i) {} Complex operator + (const Complex &p) const { return Complex(r + p.r, i + p.i); }…
题目戳我 \(\text{Solution:}\) 考虑第二问,赢的局数最小,即输和平的局数最多. 考虑网络流,\(1,2,3\)表示\(Alice\)选择的三种可能性,\(4,5,6\)同理. 它们像源点和汇点连的是局数为容量的边,然后对于能和它平的和输的连边,边权为\(inf\),因为源点和汇点已经限制了流量,这里直接\(inf\)即可. 第一问就是三个数的三个最小值相加. #include<bits/stdc++.h> using namespace std; int n,a[4],b[…
一眼题. 第一问很简单吧,就是每个 \(\tt Alice\) 能赢的都尽量让他赢. 第二问很简单吧,就是让 \(\tt Alice\) 输的或平局的尽量多,于是跑个网络最大流.\(1 - 3\) 的点表示 \(\tt Alice\) 选石头剪刀或布,\(4-6\) 表示\(\tt Bob\) 选石头剪刀或布.显然源点连 \(1-3\), \(4-6\) 连汇点.然后把 \(\tt Alice\) 输或 \(\tt Alice\) 平的连一下就好了呀. #include<bits/stdc++.…
描述 Rock, Paper, Scissors is a classic hand game for two people. Each participant holds out either a fist (rock), open hand (paper), or two-finger V (scissors). If both players show the same gesture, they try again. They continue until there are two d…