277 字
1 分钟
P9586 游戏 题解
分析
一道简单的模拟题,考场很快想出正解。
然后考虑小C获胜的情况:小C想要获胜,作为先手,只有自己的杀比小D的闪要多,或者自己的斩比小D的杀要多时.他是一定能获胜的。即 或 时,小C获胜。
首先分析题意,不难发现:杀与闪是克制关系,斩和杀是克制关系。
接下来考虑小D获胜的情况:在小C第一轮不能获胜后,小C能做的最优策略就是尽可能的消耗小D的牌。如果消耗完之后,小D的杀依然比小C的闪要多,或者自己的斩比小C的杀要多时,小D获胜。
如果两种情况都不满足,那就是平局了。
Code
#include <bits/stdc++.h>using namespace std;#define ll long long#define int llconst int MaxN = 1e6 + 100;const int INF = 1e9;int T=1, N, M;
inline void Solve(){ int sha1,shan1,zhan1,sha2,zhan2,shan2; cin>>sha1>>shan1>>zhan1>>sha2>>shan2>>zhan2; if(sha1>shan2||zhan1>sha2){//小C Win puts("C"); } else{ shan2-=sha1; sha2-=zhan1; if(sha2>shan1||zhan2>sha1){//小D Win puts("D"); } else{ puts("E");//平局 } }}signed main(){ //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); ios::sync_with_stdio(0); cin>>T; while(T--) Solve(); return 0;}
P9586 游戏 题解
https://blog.introl.top/posts/p9586-游戏-题解/