题解:P13365 [GCJ 2011 #1A] FreeCell Statistics
题解:P13365 [GCJ 2011 #1A] FreeCell Statistics
题目链接
思路
首先分类讨论:
当今日胜率
当
对于
最后输出判断结果。
Code
#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;
}