Big Number

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 5857    Accepted Submission(s):
4093
点我

Problem Description
As we know, Big Number is always troublesome. But it's
really important in our ACM. And today, your task is to write a program to
calculate A mod B.

To make the problem easier, I promise that B will be
smaller than 100000.

Is it too hard? No, I work it out in 10 minutes, and
my program contains less than 25 lines.

 
Input
The input contains several test cases. Each test case
consists of two positive integers A and B. The length of A will not exceed 1000,
and B will be smaller than 100000. Process to the end of file.
 
Output
For each test case, you have to ouput the result of A
mod B.
 
Sample Input
2 3
12 7
152455856554521 3250
 
Sample Output
2
5
1521
 #include <iostream>
#include <cstring>
using namespace std;
int main()
{
int n,i,j;
char a[];
while(cin>>a>>n)
{
int count=,c=,m=;
count=strlen(a)-;
for(i=;i<=count;i++)
{
m=a[i]-''+c*;
c=m%n;
}
cout<<c<<endl;
memset(a,,sizeof(a));
}
}

Big Number(大数)的更多相关文章

  1. HDU 1212 Big Number 大数模小数

    http://acm.hdu.edu.cn/showproblem.php?pid=1212 题目大意: 给你一个长度不超过1000的大数A,还有一个不超过100000的B,让你快速求A % B. 什 ...

  2. UVA题目分类

    题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...

  3. 杭电ACM分类

    杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...

  4. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

  5. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  6. 如何运用同余定理求余数【hdoj 1212 Big Number【大数求余数】】

    Big Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  7. HDOJ 1018 Big Number(大数位数公式)

    Problem Description In many applications very large integers numbers are required. Some of these app ...

  8. HDU 1018Big Number(大数的阶乘的位数,利用公式)

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1018 Big Number Time Limit: 2000/1000 MS (Java/Others) ...

  9. 题解报告:hdu 1212 Big Number(大数取模+同余定理)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1212 Problem Description As we know, Big Number is al ...

  10. Codeforces C. Split a Number(贪心大数运算)

    题目描述: time limit per test 2 seconds memory limit per test 512 megabytes input standard input output ...

随机推荐

  1. Hdu1090

    #include <stdio.h> int main() { int i,T,a,b; scanf("%d",&T); ;i<T;i++){ scanf ...

  2. 论JS的重要性

    最近有学习了JavaScript,学习的过程中发现js对于前端工程师来说可以是最终要的一部分. 个人认为js就是一门语言,如果把前端比作一个人的身体,那么html就是一个人的结构,css就是这个人长的 ...

  3. python----抽象类

    #!/usr/local/python3.5/bin/python3.5 ####实现方法一 class Supper(object): def delegate(self): self.action ...

  4. [转]让Sublime Text2支持浏览器中预览

    转自http://www.imququ.com/post/view-sublime-text-2-file-in-browser.html 1.点击菜单Tools -> New Plugin.. ...

  5. Effective Java从零开始 - 就是爱Java

    或许你已经开始写Java了,或许只是想要一窥这个的世界,无论是抱着何种心情来看Java,从零开始,会一种没有负担,没有包袱的事,你会发现写程序不再是枯燥乏味,孤单寂寞的一个人,而是生活中最快乐的学习之 ...

  6. 电子工程师名片——UFI Command,USB盘符的显示

    USB Mass Storage类规范概述        USB Mass storage Device协议即海量存储设备协议适用于硬盘,U盘等大容量存储设备.协议使用的接口端点有BulkIn.Bul ...

  7. C# 内存泄露

    一.事件引起的内存泄露 1.不手动注销事件也不发生内存泄露的情况 我们经常会写EventHandler += AFunction; 如果没有手动注销这个Event handler类似:EventHan ...

  8. nginx配置 的话注意几点 1.错误时注意看log 2.天威证书的话,有文档按照其文档一步步配置即可;3每句话的结尾注意千万别丢掉分号

    nginx配置 的话注意几点 1.错误时注意看log  2.天威证书的话,有文档按照其文档一步步配置即可:3每句话的结尾注意千万别丢掉分号:4.配置https时 其转发可以转发到http上 pass_ ...

  9. svn local delete, incoming delete upon update 解决办法

    经常有人会说,树冲突是很难解决的一类冲突,其实一旦了解了其原理,要解决也不难.先回顾下对于树冲突的定义.     树冲突:当一名开发人员移动.重命名.删除一个文件或文件夹,而另一名开发人员也对它们进行 ...

  10. html&CSS初学

    <link href="https://fonts.gdgdocs.org/css?family=Lobster" rel="stylesheet" ty ...