Codeforces 154D
来源:互联网 发布:杭电网络攻防平台 编辑:程序博客网 时间:2024/06/11 09:37
分类讨论
if 可以一步杀死
else if如果a<=0 肯定是draw
else 只能不断靠近
1.错过了 draw
2.一定有一个死
#include<cstdio>#include<iostream>#include<cstring>using namespace std;const int N=1e5+10;int aa[N],bb[N],id[N];int vis[N];const int inf=1<<30;int sta[N],top;int sum[N*2];int main(){ #ifdef DouBi freopen("in.cpp","r",stdin); //freopen("out.cpp","w",stdout); #endif // DouBi int l,r,a,b;while(scanf("%d%d%d%d",&l,&r,&a,&b)!=EOF){ int flag=0; if(l>r){ flag=1; swap(l,r);swap(a,b);a*=-1;b*=-1; } if(r-l>=a&&r-l<=b){ printf("FIRST\n"); if(!flag)printf("%d\n",r); else printf("%d\n",l); continue;///first win } if(a<=0){ printf("DRAW\n");continue; } int x=(r-l)%(a+b); if(x>=1&&x<=b){ if(x<a)printf("DRAW\n"); else { printf("FIRST\n"); if(!flag)printf("%d\n",l+x); else printf("%d\n",r-x); } } else { if(x!=0)printf("DRAW\n"); else printf("SECOND\n"); } } return 0;}
0 0
- Codeforces 154D
- CodeForces 617D CodeForces 617D
- CodeForces 101D
- CodeForces 103D
- CodeForces 222D Olympiad
- codeforces 242d
- CodeForces 111D
- 【codeforces】3D
- CodeForces 127D Password
- codeforces 257D. Sum
- Codeforces 292D
- Codeforces 275D
- Codeforces 126D
- Codeforces 337d
- Codeforces D. Points
- codeforces 96D Volleyball
- Codeforces 165D
- codeforces 180D
- unity3d问题集 <2> 对Vector3.Lerp 插值的理解
- MD5加密工具类
- 修改Eclipse的默认debugKeyStore为带签名的keyStore,方便调试需要验证MD5值的地方
- mysql关于表设计的主键策略
- 阿里的maven镜像地址
- Codeforces 154D
- 2016 ~ 每一年的事都将是故事
- ajax 实现加载进度条
- 2016-12-23 微信硬件 ble_wechat_util.h移植记录二
- 1016. Phone Bills (25)
- springMVC接受list报错:Could not instantiate bean class [java.util.List]: Specified class is an interf
- javaWeb学习(3)——WebServlet格式总结
- No suitable driver found for jdbc
- sublime text不能安装插件,there are no packages available for installation。