Large Division

Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exists an integer c such that a = b * c.

Input

Input starts with an integer T (≤ 525), denoting the number of test cases.

Each case starts with a line containing two integers a (-10^200 ≤ a ≤ 10^200) and b (|b| > 0, b fits into a 32 bit signed integer). Numbers will not contain leading zeroes.

Output

For each case, print the case number first. Then print 'divisible' if a is divisible by b. Otherwise print 'not divisible'.

Sample Input

6

101 101

0 67

-101 101

7678123668327637674887634 101

11010000000000000000 256

-202202202202000202202202 -101

Sample Output

Case 1: divisible

Case 2: divisible

Case 3: divisible

Case 4: not divisible

Case 5: divisible

Case 6: divisible

可以用JAVA:

import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t=in.nextInt();
int sum;
sum=0;
BigInteger a,b;
BigInteger c=BigInteger.valueOf(0);
while(t-->0) {
sum++;
a=in.nextBigInteger();
b=in.nextBigInteger();
if(a.remainder(b).equals(c)) //equal括号内的数据类型必须是大整数类的,不能是int类型的。
System.out.println("Case "+sum+": divisible");
else
System.out.println("Case "+sum+": not divisible");
}
}
}

(大数 求余) Large Division Light OJ 1214的更多相关文章

  1. POJ 2635 The Embarrassed Cryptographer(大数求余)

    题意:给出一个大数,这个大数由两个素数相乘得到,让我们判断是否其中一个素数比L要小,如果两个都小,输出较小的那个. 分析:大数求余的方法:针对题目中的样例,143 11,我们可以这样算,1 % 11 ...

  2. light oj 1214 - Large Division 大数除法

    1214 - Large Division Given two integers, a and b, you should check whether a is divisible by b or n ...

  3. light oj 1214 - Large Division

    1214 - Large Division   PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 32 MB G ...

  4. Large Division (大数求余)

    Given two integers, a and b, you should check whether a is divisible by b or not. We know that an in ...

  5. Light OJ 1214

    简单大数模拟题: #include<bits/stdc++.h> using namespace std; typedef long long ll; string Num; vector ...

  6. Project Euler 48 Self powers( 大数求余 )

    题意: 项的自幂级数求和为 11 + 22 + 33 + - + 1010 = 10405071317. 求如下一千项的自幂级数求和的最后10位数字:11 + 22 + 33 + - + 100010 ...

  7. POJ2635-The Embarrassed Cryptographer 大数求余

    题目链接:http://poj.org/problem?id=2635 题目分析: http://blog.csdn.net/lyy289065406/article/details/6648530

  8. 大数求模 sicily 1020

        Search

  9. 2016中国大学生程序设计竞赛 - 网络选拔赛 1001 A water problem (大数取余)

    Problem Descripton Two planets named Haha and Xixi in the universe and they were created with the un ...

随机推荐

  1. CentOS 6.7下 Samba服务器的搭建与配置(share共享模式)

    https://www.linuxidc.com/Linux/2016-12/138220.htm

  2. 【个人阅读作业】软件工程M1/M2总结

    链接:”看<快速软件开发>的五个问题“ http://www.cnblogs.com/leiyy/p/4027759.html 一.较为明白的问题 1. 在文章的第一个关于Square_T ...

  3. Jquery画折线图、柱状图、饼图

    1.今天做了一个折线图,首先需要导js文件.这里有一个demo:http://files.cnblogs.com/files/feifeishi/jquery_zhexiantubingtuzhuzh ...

  4. 第三个spring冲刺第8天

    今天,我们忙于完成精美的背景,还有难度的具体设置,如何达到最理想化,为此我们今天主要是做了开会讨论,但还没有完全确定好结论,明天就应该能做出结论,然后修改后台的难度设置了.

  5. [转帖]老狼:你知道哪些关于 Windows 10 的骚操作?

    作者:老狼链接:https://www.zhihu.com/question/265781599/answer/579939418来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注 ...

  6. PSP(4.27——5.3)以及周记录

    1.PSP 4.27 11:40 18:10 125 265 Cordova A Y min 4.28 10:00 16:50 200 210 Cordova A Y min 4.29 15:30 2 ...

  7. Gulp实现静态网页模块化的方法详解

    前言: 在做纯静态页面开发的过程中,难免会遇到一些的尴尬问题.比如:整套代码有50个页面,其中有40个页面顶部和底部模块相同.那么同样的两段代码我们复制了40遍(最难受的方法).然后,这个问题就这样解 ...

  8. codeforces710B

    Optimal Point on a Line CodeForces - 710B You are given n points on a line with their coordinates xi ...

  9. NVIDIA面目生成器再做突破

    导读 NVIDIA创建的AI系统“GAN”可以通过对图像数据库的学习,来随机生成超逼真人脸照片而一炮走红,经过长时间的研发与晚上目前这套系统已经有了极大的进步.除了可以自主学习之外,生成的内容逼真,让 ...

  10. MySQL Binlog详解

    MySQL Binlog详解 Mysql的binlog日志作用是用来记录mysql内部增删改查等对mysql数据库有更新的内容的记录(对数据库的改动),对数据库的查询select或show等不会被bi ...