2020hdoj多校赛第六场1009

题目链接
题目

解题思路:
b进制数最后成为只有一位的数时取值为[0,b-1],看其能否被x整除即可。
AC代码:

#include<iostream>
#include<cstdio>
#include<set>
#include<algorithm>
#include<stdlib.h>
using namespace std;
typedef long long ll;
int main()
{
    
    
    int T;
    scanf("%d",&T);
    while(T--)
    {
    
    
        ll b,x;
        scanf("%lld %lld",&b,&x);
        if((((b-1)/x)*x)==(b-1))
            printf("T\n");
        else
            printf("F\n");
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_44063734/article/details/107854489