K - Large Division

LightOJ - 1214

大数模拟,记得把符号去掉

 1 #include <iostream>
 2 #include <cstring>
 3 #include <string>
 4 #include <map>
 5 #include <set>
 6 #include <algorithm>
 7 #include <fstream>
 8 #include <cstdio>
 9 #include <cmath>
10 #include <stack>
11 #include <queue>
12 using namespace std;
13 const double Pi=3.14159265358979323846;
14 typedef long long ll;
15 const int MAXN=5000+5;
16 const int dx[5]={0,0,0,1,-1};
17 const int dy[5]={1,-1,0,0,0};
18 const int INF = 0x3f3f3f3f;
19 const int NINF = 0xc0c0c0c0;
20 int main()
21 {
22     int t;cin>>t;int cnt=0;
23     while(t--)
24     {
25         string str;cin>>str;ll n;cin>>n;
26         if(str[0]=='-')
27             str.erase(str.begin());
28         ll sum=0;
29         for(int i=0;i<str.size();i++)
30         {
31             sum=sum*10+str[i]-'0';
32             sum=sum%n;
33         }
34         if(sum==0) printf("Case %d: divisible\n",++cnt);
35             else printf("Case %d: not divisible\n",++cnt);
36
37     }
38     return 0;
39 } 

转载于:https://www.cnblogs.com/Msmw/p/10991230.html

大数模拟——K - Large Division LightOJ - 1214相关推荐

  1. lightoj 1214

    lightoj 1214 Large Division  (大数除法) 链接:http://www.lightoj.com/volume_showproblem.php?problem=1214 题意 ...

  2. Light OJ 1214 Large Division (大数取模)

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

  3. hdu 5568(dp+大数模拟)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5568 官方题解: #include <cstdio> #include <cstri ...

  4. 1136. A Delayed Palindrome (20) 大数模拟

    1136. A Delayed Palindrome (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...

  5. 【PTA天梯赛CCCC -2017决赛L1-6 】整除光棍 (20 分)(大数模拟除法)

    题干: 这里所谓的"光棍",并不是指单身汪啦~ 说的是全部由1组成的数字,比如1.11.111.1111等.传说任何一个光棍都能被一个不以5结尾的奇数整除.比如,111111就可以 ...

  6. 【HDU - 1013 】Digital Roots (大数模拟)

    题干: The digital root of a positive integer is found by summing the digits of the integer. If the res ...

  7. “kuangbin带你飞”专题计划——专题十四:数论基础

    写在前面 1.目前还没啥写的.开始时间:2021-05-13(其实博客上看得到该博客创建时间的) 2.上一个专题刷的是网络流(博客总结),属于第一次接触.本来想的是一周特别高效,然后一周略划水,结果是 ...

  8. 19级HPU算法协会公开课第三期: 【基础数学】 题解

    基础数学[数论] A - Bi-shoe and Phi-shoe (LightOJ - 1370) 分析 代码 B - Aladdin and the Flying Carpet (LightOJ ...

  9. [kuangbin带你飞]专题十四 数论基础

    A - Bi-shoe and Phi-shoe --筛素数 题意 一个竹竿长度为p,它的score值就是比p长度小且与且与p互质的数字总数,比如9有1,2,4,5,7,8这六个数那它的score就是 ...

  10. kuangbin带你飞专题合集

    题目列表 [kuangbin带你飞]专题一 简单搜索 [kuangbin带你飞]专题二 搜索进阶 [kuangbin带你飞]专题三 Dancing Links [kuangbin带你飞]专题四 最短路 ...

最新文章

  1. mysql运维工资_MySQL运维踩坑
  2. vue-cli的使用
  3. 并查集练习(0743) SWUST OJ
  4. 【渝粤题库】国家开放大学2021春2444酒店管理概论答案
  5. 《DBNotes:Join算法的前世今生》
  6. 算法五——字符串匹配(上)
  7. 红帽linux 竞争对手,为什么红帽不把CentOS当作竞争对手?
  8. 四:客服端防护HTTP发送请求类
  9. npm 端口设置成80_13 个 NPM 快速开发技巧
  10. 程序员面试金典——9.5字符串排列
  11. dhtmlxGantt standard vs dhtmlxGantt pro
  12. diffuse、specular贴图的光照
  13. 实现ftpserver
  14. win10无限蓝屏_升级 Win10 后系统蓝屏或无限重启的解决方法之一
  15. 如何判断网站SSL证书是否安装成功?
  16. python项目之杠子老虎鸡虫
  17. 扫地机器人的特点描写_扫地机器人的特点是什么 扫地机器人的原理
  18. UR5双臂Gazebo仿真(Python)
  19. ai星际探索 爪子_通过特征空间探索实现可解释的人工智能
  20. 以太坊原理分析(一)以太坊工作(交易)原理

热门文章

  1. php---遍历一个数组获得一个新的数据结构
  2. Docker两种方式进入后台运行的容器
  3. Eclipse中移除native层编译支持
  4. TLS总结(上)——我们为啥需要TLS
  5. xampp修改mysql的默认空密码
  6. mysql的json使用
  7. linux查看redis没有权限,在linux上安装redis并设置权限
  8. mac存储空间管理与df命令看到的剩余空间不一样的问题
  9. python周末_python周末作业—刘宏升
  10. Spring源码之创建AOP代理