首页 > 其他 > 详细

2020HDU多校第八场By Rynar 6867-6876

时间:2020-08-18 18:33:34      阅读:104      评论:0      收藏:0      [点我收藏+]

1003.Slime and Stones

思路;betty定理,1/x+1/(x+k+1)=1的大解,(a-b)/(k+1)*x==a时,为奇异局势,输出0,否则输出1

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
int n,m,k;
signed main(){
    int T;
    scanf("%lld",&T);
    while (T--){
        scanf("%lld%lld%lld",&n,&m,&k);
        if (n>m)swap(n,m);
        double x=(1-k+sqrt(k*k+2*k+5))/2.0;
        if ((m-n)%(k+1)){
            puts("1");continue;
        }
        int r=(m-n)/(k+1)*x;
        if (r==n)puts("0");
        else puts("1");
    }
    return 0;
}

1007.Game

2020HDU多校第八场By Rynar 6867-6876

原文:https://www.cnblogs.com/rair/p/13524849.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!