/*
LightOJ1214 Large Division
http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1214 数论 同余定理 题意:大整数取余
*
*
*
*
*/ #include <cstdio>
#include <cstring>
using namespace std;
char s[];
int main()
{
int t;
scanf("%d",&t);
long long b;
for(int i=;i<=t;i++)
{
printf("Case %d: ",i);
getchar();
scanf("%s",s);
scanf("%lld",&b);
int n=strlen(s);
long long num=0LL;
for(int i=;i<n;i++)
{
if(s[i]=='-')
continue;
num=(num*10LL+s[i]-'')%b;
}
if(num==0LL)
printf("divisible\n");
else
printf("not divisible\n");
}
return ;
}

LightOJ1214 Large Division的更多相关文章

  1. LightOJ1214 Large Division —— 大数求模

    题目链接:https://vjudge.net/problem/LightOJ-1214 1214 - Large Division    PDF (English) Statistics Forum ...

  2. LightOJ1214 Large Division 基础数论+同余定理

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

  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 Light OJ 1214

    Large Division Given two integers, a and b, you should check whether a is divisible by b or not. We ...

  5. LightOJ 1214 Large Division

    Large Division Given two integers, a and b, you should check whether a is divisible by b or not. We ...

  6. 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 ≤ ...

  7. 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 ...

  8. 1214 - Large Division -- LightOj(大数取余)

    http://lightoj.com/volume_showproblem.php?problem=1214 这就是一道简单的大数取余. 还想还用到了同余定理: 所谓的同余,顾名思义,就是许多的数被一 ...

  9. LightOJ 1214 Large Division 水题

    java有大数模板 import java.util.Scanner; import java.math.*; public class Main { public static void main( ...

随机推荐

  1. 线程同步、死锁和通信——Java多线程(二)

    一.多线程同步 上一篇随笔中,我曾遇到对多线程程序的多次运行结果不一致的情况,这主要是因为没有对这些线程在访问临界资源做必要的控制,而接下来就用线程的同步来解决这个问题. 1.同步代码块 class ...

  2. hdu1829 A Bug&#39;s Life(并查集)

    开两个并查集.然后合并的时候要合并两次.这样在合并之前推断是否冲突,假设不冲突就进行合并,否则不须要继续合并. #include<cstdio> #include<cstdlib&g ...

  3. ubuntu修改capslock键,单独使用为esc,组合使用时为ctrl+

    一.下面这部分可以将capslock与ctrl互换 将下面的代码放入-/.Xmodmap中, remove Lock = Caps_Lock remove Control = Control_L ke ...

  4. Node.js:NPM 使用介绍

    ylbtech-Node.js:NPM 使用介绍 1.返回顶部 1. NPM 使用介绍 NPM是随同NodeJS一起安装的包管理工具,能解决NodeJS代码部署上的很多问题,常见的使用场景有以下几种: ...

  5. 5、Iterator迭代器的使用

    package cn.itcast_02; import java.util.ArrayList; import java.util.Collection; import java.util.Iter ...

  6. Oracle---显式游标

    一  游标的分类 在Oracle中提供了两种类型的游标:静态游标和动态游标. 1.静态游标是在编译时知道其SELECT语句的游标.静态游标又分为两种类型,即隐式游标和显式游标. 2.当用户需要为游标使 ...

  7. SQLServer int转float

    例: select 2/4  会得到0 改为 select 2/4.0 则会得到0.500000 也同时达到了int转float的效果

  8. RoIPooling与RoIAlign的区别

    一.RoIPooling与RoIAlign 1.1.RoIPooling 通过对Faster RCNN的学习我妈了解的RolPooling可以使生成的候选框region proposal映射产生固定大 ...

  9. redis的跳跃表

    跳跃表是一种插入.查询.删除的平均时间复杂度为O(nlogn)的数据结构,在最差情况下是O(n),当然这几乎很难出现. 和红黑树相比较 最差时间复杂度要差很多,红黑树是O(nlogn),而跳跃表是O( ...

  10. 互联网的大数据神话——NoSQL

    本文摘抄于:<纵横大数据--云计算数据基础设施> 何小朝著 Chapter5. NewSQL--关系数据库联邦/联合 5.4.2  互联网的神话 对强一致性的要求放松,是因为 互联网的分布 ...