专栏文章
题解:P13365 [GCJ 2011 #1A] FreeCell Statistics
P13365题解参与者 1已保存评论 1
文章操作
快速查看文章及其快照的属性,并进行相关操作。
- 当前评论
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @miosbhpg
- 此快照首次捕获于
- 2025/12/03 00:20 3 个月前
- 此快照最后确认于
- 2025/12/03 00:20 3 个月前
题解:P13365 [GCJ 2011 #1A] FreeCell Statistics
思路
首先分类讨论:
当今日胜率 为 时,总局胜率 不能是 ,因为今日至少玩了一局且全输;
当 为 时, 不能是 ,因为今日至少赢了一局。
对于 的情况,需要计算最小可能的 值,若这个最小 超过 则不可能。此外, 不能为 或 ,否则会导致矛盾。
最后输出判断结果。
Code
CPP#include<bits/stdc++.h>
#define int long long
using namespace std;
int t,n,pd,pg;
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>t;
for(int cas=1;cas<=t;cas++){
cin>>n>>pd>>pg;
cout<<"Case #"<<cas<<": ";
if(pd==0){
if(pg!=100)cout<<"Possible\n";
else cout<<"Broken\n";
}
else if(pd==100){
if(pg!=0)cout<<"Possible\n";
else cout<<"Broken\n";
}
else{
int g=__gcd(pd,100ll);
int d=100/g;
if(d>n)cout<<"Broken\n";
else{
if(pg!=0&&pg!=100)cout<<"Possible\n";
else cout<<"Broken\n";
}
}
}
return 0;
}
相关推荐
评论
共 1 条评论,欢迎与作者交流。
正在加载评论...