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 ≤ 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). 思路:取余;的更多相关文章
- light oj 1214 - Large Division
1214 - Large Division PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 32 MB G ...
- 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 Given two integers, a and b, you should check whether a is divisible by b or n ...
- (大数 求余) 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 ...
- LightOJ1214 Large Division —— 大数求模
题目链接:https://vjudge.net/problem/LightOJ-1214 1214 - Large Division PDF (English) Statistics Forum ...
- 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 ...
- lightoj--1214--Large Division(大数取余)
Large Division Time Limit: 1000MS Memory Limit: 32768KB 64bit IO Format: %lld & %llu Submit ...
- LightOJ1214 Large Division
/* LightOJ1214 Large Division http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1 ...
随机推荐
- React Native之iOS App打包
iOS打包步骤(一.二.三可不按照顺序) 步骤一: 选择iOS Device(以下两者选其中一个即可) 选择 Generic iOS Device (个人建议使用这个) 选择Generic iOS D ...
- fidder模拟post提交到PHP遇到的问题
http头必须带上Content-type: application/x-www-form-urlencoded 之后 ,php 才能接收到post数据 1. 用php://input可以很便捷的取 ...
- ftrace
下面是一些关于ftrace的博文: ftrace 简介(IBM) 使用 ftrace 调试 Linux 内核 第 1 部分 第 2 部分 第 3 部分 Android系统性能调优工具介绍
- nginx+php-fpm页面显示空白的解决方法
在nginx与php的环境中,配置了一个wordpress,访问时发现php的页面一直显示空白,起初以为是权限问题,将权限改成755后还是不行. 然后,开启nginx和php的日志,但在日志里也没 ...
- ajax回调中window.open弹出的窗口会被浏览器拦截的解决方法
存在问题:处理页面ajax请求过程中,异步请求成功后需要新开窗口打开 url,使用的是 window.open() 方法 来实现,最终都被浏览器拦截了.不会跳到对应的页面,如下 原因:浏览器之所以拦截 ...
- AJAX && JSON之讲解
Ajax技术的核心是XMLHttpRequest对象(简称XHR),可以通过使用XHR对象获取到服务器的数据,然后再通过DOM将数据插入到页面中呈现.虽然名字中包含XML,但Ajax通讯与数据格式无关 ...
- 用 JavaScript 检测浏览器在线/离线状态(JavaScript API — navigator.onLine)
如今HTML5 移动应用或 Web app 中越来越普遍的使用了离线浏览技术,所以用 JavaScript 检测浏览器在线/离线状态非常常见. 无论浏览器是否在线,navigator.onLine 属 ...
- http://blog.csdn.net/hahalzb/article/details/5889545
http://blog.csdn.net/hahalzb/article/details/5889545
- pl/sql游标
通过游标,我们可以取得返回结果集的任何一行记录,提高效率. 定义游标: type 游标名 is ref cursor 变量名 游标名 打开游标: open 游标变量 for select语句: 取出当 ...
- 在Docker中从头部署自己的Spark集群
由于自己的电脑配置普普通通,在VM虚拟机中搭建的集群规模也就是6个节点左右,再多就会卡的不行 碰巧接触了Docker这种轻量级的容器虚拟化技术,理论上在普通PC机上搭建的集群规模可以达到很高(具体能有 ...