/**
题目:K - Large Division
链接:https://vjudge.net/contest/154246#problem/K
题意:判断a是否是b的倍数。 a (-10^200 ≤ a ≤ 10^200) and b (|b| > 0, b fits into a 32 bit signed integer).
思路:取余; */ #include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
char a[];
bool solve(ll mod)
{
ll r = ;
for(int i = ; a[i]!='\0'; i++){
if(a[i]=='-') continue;
r = r*+(a[i]-'');
r %= mod;
}
return r==;
}
int main()
{
int T, cas=;
ll mod;
cin>>T;
while(T--)
{
scanf("%s%lld",a,&mod);
if(mod<) mod = -mod;
printf("Case %d: %s\n",cas++,solve(mod)?"divisible":"not divisible");
}
return ;
}

K - Large Division 判断a是否是b的倍数。 a (-10^200 ≤ a ≤ 10^200) and b (|b| > 0, b fits into a 32 bit signed integer). 思路:取余;的更多相关文章

  1. light oj 1214 - Large Division

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

  2. LightOJ 1214 Large Division

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

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

  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. LightOJ1214 Large Division —— 大数求模

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

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

  7. Large Division (大数求余)

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

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

    Large Division Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %lld & %llu Submit ...

  9. LightOJ1214 Large Division

    /* LightOJ1214 Large Division http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1 ...

随机推荐

  1. 动态NAT地址转换

    1.配置路由器的端口ip地址(注意外网和内网ip地址的设置) Router(config)#inter f0/0 Router(config-if)#ip add 192.168.1.1 255.25 ...

  2. 如何在mac中通过命令行使用sublime

    ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl 后续就可以通过  ...

  3. Java压缩字符串的方法收集

    说明: 1.一般来说要实现压缩,那么返回方式一般是用byte[]数组. 2.研究发现byte[]数组在转成可读的String时,大小会还原回原来的. 3.如果采用压缩之后不可读的String时,互相转 ...

  4. 【java】值传递和引用传递---对象作为方法的参数传入属于哪种传递

    首先 这篇作为一个永久性的问题,欢迎大家讨论 其次,个人结论如下几条: ①Java有且只有一种传递,即 值传递 ②作为方法的参数传入,都是对原本的实参进行了copy ③只不过[实参]若是[基本数据类型 ...

  5. VSM(Virtual Storage Manager For Ceph)安装教程

    转载注明出处,陈小跑 http://www.cnblogs.com/chenxianpao/p/5770271.html 一.安装环境 OS:CentOS7.2 VSM:v2.1 released 二 ...

  6. DEDECMS爆严重安全漏洞

    简要描述: 众所周知,因使用简单.客户群多,织梦CMS一直被爆出许多漏洞.“DEDECMS爆严重安全漏洞,近期官方会发布相关补丁,望大家及时关注补丁动态.” 详细说明: http://www.xx.c ...

  7. XSS-Proxy之技术总结

    今天看了大风的文章,关于Cross Iframe Trick的思路.让我想到了曾经看到的关于XSS Proxy的一些文章. Advanced Cross-Site-Scripting with Rea ...

  8. 贯通Spark Streaming流计算框架的运行源码

    本章节内容: 一.在线动态计算分类最热门商品案例回顾 二.基于案例贯通Spark Streaming的运行源码 先看代码(源码场景:用户.用户的商品.商品的点击量排名,按商品.其点击量排名前三): p ...

  9. 第五章:关于ESearch的应用

    ElasticSearch是一个开源的分布式搜索引擎,具备高可靠性,支持非常多的企业级搜索用例. 我在这里做一下简单介绍和整理: 首先.ES搜索引擎给予java开放使用之前必须安装java环境,使用j ...

  10. 手写一个死锁Demo

    相互持有对方锁,导致死锁 package jesse.test04; public class DeadLockSample extends Thread{ private String first; ...