当前位置:网站首页>(2022杭电多校五)1010-Bragging Dice (思维)
(2022杭电多校五)1010-Bragging Dice (思维)
2022-08-03 03:24:00 【AC__dream】



样例输入:
1
5
4 6 4 1 2
3 6 6 2 3
样例输出:
Win!
分析:这道题其实卡了挺久的,因为我一开始就感觉直接输出Win!即可,但是不知道为什么一直wa,因为我当时想的是既然双方都知道骰子是什么情况,那么我就直接说出一个正确的且对方无法claim的方案,那么先手就稳胜了,这样的方案一定是存在的,因为比如我现在随便说出一种方案,那么如果存在一种方案可以claim,那么我就直接输出claim的那种方案,直到不能claim为止,现在这是可行的,但是没注意到的一点是claim的点数必须是大于0的,但是题目中说了如果所有一个杯中所有点数都是不同的,那么我就认为没有点数,所以有可能一开始两个杯子每个杯中的骰子点数都是不同的,但是先手无法说0,那么先手就输了,除此之外的任何一种情况都是先手必胜的。
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<vector>
#include<cmath>
using namespace std;
const int N=1e4+10;
int vis[10];
int main()
{
int T;
cin>>T;
int n;
while(T--)
{
bool flag=false;
for(int i=1;i<=6;i++) vis[i]=0;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
int t;
scanf("%d",&t);
if(vis[t]) flag=true;
vis[t]++;
}
for(int i=1;i<=6;i++) vis[i]=0;
for(int i=1;i<=n;i++)
{
int t;
scanf("%d",&t);
if(vis[t]) flag=true;
vis[t]++;
}
if(flag) puts("Win!");
else puts("Just a game of chance.");
}
return 0;
}
边栏推荐
猜你喜欢
随机推荐
【leetcode热题Hot100】——LRU缓存
Task Scheduler 计划定时任务,修改时报错: One or more of the specified arguments are not valid
SqlSession [[email protected]]
OneNote 教程,如何在 OneNote 中设置笔记格式?
How to write test cases in software testing technology (2)
一次偶然的钓鱼文件分析
【 original 】 Auto. Js the get and post case
(一)Nacos注册中心集群环境搭建
【TA-霜狼_may-《百人计划》】先行部分 手搓视差体积云
移植RT-Thread编译报错thumb conditional instruction should be in IT block
js Fetch返回数据res.json()报错问题
Dynamically modify the title of the navigation bar in uniapp
在VScode里调试ROS程序
els 计分
js的组成及js样式
我的“眼睛”就是尺!
【数据分析】基于MATLAB实现SVDD决策边界可视化
Guys, I don't understand a bit: why the documentation of oracle-cdc writes that the connector can be done exactly-o
【剑指offer】——股票的最大利润
05-分布式计算框架









