Codeforces 451C. Predict Outcome of the Game
来源:互联网 发布:成都网络服务器租用 编辑:程序博客网 时间:2024/06/04 20:21
暴力模拟....
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long int LL;int main(){int T_T;scanf("%d",&T_T);while(T_T--){LL n,k,d1,d2,RES,res;scanf("%I64d%I64d%I64d%I64d",&n,&k,&d1,&d2);RES=n-k;bool flag=false;///cas 00LL low=d1+d1+d2;if(k>=low&&(k-low)%3==0){res=RES;if(res>=d1+2*d2){res-=d1+2*d2;if(res%3LL==0){flag=true;puts("yes");continue;}}}///cas 11low=d2+d2+d1;if(k>=low&&(k-low)%3==0){res=RES;if(res>=d2+d1*2){res-=d2+2*d1;if(res%3LL==0){flag=true;puts("yes");continue;}}}///cas 10if(d1>=d2){low=d1+d1-d2;if((k-low>=0&&(k-low)%3==0)){res=RES;if(res>=d1+d2){res-=d1+d2;if(res%3LL==0){flag=true;puts("yes");continue;}}}}else{low=d2+d2-d1;if((k-low>=0&&(k-low)%3==0)){res=RES;if(res>=d1+d2){res-=d1+d2;if(res%3LL==0){flag=true;puts("yes");continue;}}}}///cas 01if(k>=d1+d2&&(k-d1-d2)%3==0){res=RES;if(d1>d2){if(res>=d1+(d1-d2)){res-=d1+(d1-d2);if(res%3LL==0){flag=true;puts("yes");continue;}}}else{if(res>=d2+(d2-d1)){res-=d2+(d2-d1);if(res%3LL==0){flag=true;puts("yes");continue;}}}}if(flag==false)puts("no");}return 0;}
1 0
- codeforces--C. Predict Outcome of the Game
- Codeforces 451C Predict Outcome of the Game
- Codeforces 451C Predict Outcome of the Game(暴力)
- CodeForces 451 C. Predict Outcome of the Game
- Codeforces 451C. Predict Outcome of the Game
- Codeforces 451C Predict Outcome of the Game (枚举+YY)
- 451 C. Predict Outcome of the Game
- 451C - Predict Outcome of the Game
- Codeforces #258 (Div. 2) C. Predict Outcome of the Game
- codeforces 258(Div.2) C. Predict Outcome of the Game
- Codeforces Div. 2 #258-C. Predict Outcome of the Game
- CF 451 C Predict Outcome of the Game(数学题)
- Codeforces Round #258 (Div. 2) C - Predict Outcome of the Game
- Codeforces Round #258 (Div. 2) C. Predict Outcome of the Game
- Codeforces Round #258 (Div. 2) C. Predict Outcome of the Game
- Codeforces Round #258 (Div. 2/C)/Codeforces451C_Predict Outcome of the Game(枚举)
- Game Outcome CodeForces
- CodeForces 157A Game Outcome
- 可减肥人士对哦哦
- 转:编写自己的C语言头文件
- Delphi 2007在64Windows系统出现 delphi 2007 assertion failure thread32.cpp 的解决方法
- AndroidNDK 基础知识
- <img onerror="alert(1)" src="hi"></img> " strategy="CFRecommendAlgorithm">"> <img onerror="alert(1
- Codeforces 451C. Predict Outcome of the Game
- 黑马程序员——枚举类型
- ios 代理传值
- HDU 1256 画8
- JAVA版俄罗斯方块学习
- 01背包之打印路径
- poj 2686 Traveling by Stagecoach(状压dp)
- 数据库连接池异常
- UVA 10588 - Queuing at the doctors(优先队列)