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 ...
随机推荐
- 静态NAT地址转换
1.配置路由器端口ip(两个端口需要设置两个网段) Router(config)#inter f0/1 Router(confiog-if)#ip add 202.1.1.2 255.255.255. ...
- Getting terminal width in C?
转:http://stackoverflow.com/questions/1022957/getting-terminal-width-in-c 方法一: #include <sys/ioctl ...
- Coherence的NameService
Coherence*Extend模式下客户端需要连接一个或多个proxy Server从而接入集群,在一些比较大型的环境中,Proxy Server往往比较多,一旦修改起来需要修改每个配置文件,在Co ...
- ylbtech-memorandum(备忘录)-数据库设计
ylbtech-DatabaseDesgin:ylbtech-memorandum(备忘录)-数据库设计 -- ============================================ ...
- Windows 2008 R2
1简介 Windows 2008 R2是微软针对windows 7所推出的Windows server操作系统.为了使企业减少操作成本和提高效率,Windows Server 2008 R2对企业资源 ...
- (如何理解gamma校准)GAMMA测试方法及分析
http://wenku.baidu.com/link?url=Wz5oXJsFQ-TVe3qxm9Zd4pp207cQ4jmjuBnwmWAvD1ibgoI2U8y7KCFhaR9xWtu9cGLE ...
- [转载]Oracle Merge的使用
FROM: http://zhangqchang.blog.163.com/blog/static/464989732009219114653226/ 摘至网上的几个例子 一.************ ...
- Excel 对应.xml/.ftl 配置(中爆导出范文)
<?xml version="1.0"?><Workbook xmlns="urn:schemas-microsoft-com:office:sprea ...
- WIN7怎样把屏幕改为16位色
1 右击桌面,选择屏幕分辨率 2 选择高级设置 3 点击"监视器"选项卡,把颜色改为16位. 4 屏幕会暂时黑屏一段时间,随后主题将自动切换为基础版(失去Areo效果) ...
- odoo8.0条形码改为js方式处理
群里网友@上海-gavin 提供的odoo条形码处理,将原来的图片生成方式改为js处理方式. <div class="row text-center"> <div ...