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 (-10200 ≤ a ≤ 10200) 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,真的顶呱呱:快问问神奇海螺java大数怎么用
代码:
import java.util.Scanner;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int t;
BigInteger a,b,c = new BigInteger("0");
t = scan.nextInt();
for(int i=1;i<=t;i++) {
a = scan.nextBigInteger();
b = scan.nextBigInteger();
if(a.remainder(b).equals(c)){
System.out.println("Case "+i+": divisible");
}
else {
System.out.println("Case "+i+": not divisible");
}
}
}
}
Large Division(大数)题解的更多相关文章
- LightOJ1214 Large Division —— 大数求模
题目链接:https://vjudge.net/problem/LightOJ-1214 1214 - Large Division PDF (English) Statistics Forum ...
- 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 ...
- L - Large Division (大数, 同余)
Given two integers, a and b, you should check whether a is divisible by b or not. We know that an in ...
- Large Division (大数求余)
Given two integers, a and b, you should check whether a is divisible by b or not. We know that an in ...
- (大数 求余) Large Division Light OJ 1214
Large Division Given two integers, a and b, you should check whether a is divisible by b or not. We ...
- LightOJ 1214 Large Division
Large Division Given two integers, a and b, you should check whether a is divisible by b or not. We ...
- light oj 1214 - Large Division
1214 - Large Division PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 32 MB G ...
- K - Large Division 判断a是否是b的倍数。 a (-10^200 ≤ a ≤ 10^200) and b (|b| > 0, b fits into a 32 bit signed integer). 思路:取余;
/** 题目:K - Large Division 链接:https://vjudge.net/contest/154246#problem/K 题意:判断a是否是b的倍数. a (-10^200 ≤ ...
- LightOJ1214 Large Division
/* LightOJ1214 Large Division http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1 ...
随机推荐
- flask 小入门知识点 2018.12.19
今天听得一脸懵逼,主要因为自己英文底子太差了 不耽误时间了,少总结下,开始复习... 代码: # -*- encoding: utf-8 -*- # 导入重定向模块 , url_for简易寻址跳转,j ...
- Jungle Roads---poj1251 hdu1301
Description The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid ...
- 前端 HTML body标签相关内容 常用标签 图片标签 <img/>
图片标签 <img/> 一个网页除了有文字,还会有图片.我们使用<img/>标签在网页中插入图片. <img/> 是单闭合标签 语法:<img src=&qu ...
- Mysql中Left Join 与Right Join 与 Inner Join 与 Full Join的区别
看看Left Join 与Right Join 与 Inner Join 与 Full Join对表进行操作后得到的结果. 在数据库中新建两张表,并插入要测试的数据. 新建表: USE [Test] ...
- vue中两种路由跳转拼接参数
this.$router.push({name:"Home",query:{id:1,name:2}}) // 取到路由带过来的参数 let routerParams = this ...
- 2.搭建cassandra时遇到没有公网网卡的问题
阿里云服务器有两种网络,一种是经典网络,一种是专用网络,经典网络是公网网卡的,但是专用网络是没有公网网卡的. 如图: 经典网络,公网ip是139.129.31.108: 专用网络,公网ip是 问题: ...
- FPKM\RPKM\TPM学习[转载]
转自:http://www.360doc.com/content/18/0112/02/50153987_721216719.shtml 1.问题提出 在RNA-Seq的分析中,对基因或转录本的rea ...
- python三步实现人脸识别
原文地址https://www.toutiao.com/a6475797999176417550 Face Recognition软件包 这是世界上最简单的人脸识别库了.你可以通过Python引用或者 ...
- c/c++的预处理定义 Stringizing Operator (#) Charizing Operator (#@) Token-Pasting Operator (##)
c/c++的预处理定义:一.Stringizing Operator (#)在c和c++中数字标志符#被赋予了新的意义,即字符串化操作符.其作用是:将宏定义中的传入参数名转换成用一对双引号括起来参数名 ...
- 【安装vsftpd】安装vsftpd工具步骤
1 安装vsftpd组件 [root@bogon ~]# yum -y install vsftpd 安装完后,有/etc/vsftpd/vsftpd.conf 文件,是vsftp的配置文件. 2 添 ...