I - Divisibility HDU - 6835

https://vjudge.net/contest/387998#problem/I

题意:

  判断证明:任意进制数y,如果y%x = 0,那么 (y所有位数之和)%x = 0

思路:

  思维题 可以通过观察证明

  参考证明方法:https://blog.csdn.net/m0_46209312/article/details/107869765

  I - Divisibility HDU - 6835_第1张图片

 

代码: 

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
#define gc getchar()
#define mem(a) memset(a,0,sizeof(a))
#define debug(x) cout<<"debug:"<<#x<<" = "< pii;
typedef char ch;
typedef double db;

const double PI=acos(-1.0);
const double eps=1e-6;
const int inf=0x3f3f3f3f;
const int maxn=1e5+10;
const int maxm=100+10;
const int N=1e6+10;
const int mod=1e9+7;

int main()
{
	long long b = 0 , x = 0;
 	int T = 0;
    cin >> T;
    while(T--)
	{
        cin >> b >> x;
        if (b % x == 1)
        {
        	cout << "T" << endl;
		}
        else
        {
        	cout << "F" << endl;
		}
    }
    return 0;
}

  

你可能感兴趣的:(I - Divisibility HDU - 6835)