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. NodeJS和C++的性能比较(转)

    原文地址: http://www.web-tinker.com/article/20374.html 前段时间做了个实验,测试了1E9次的空循环在NodeJS和C++中的执行用时.于是我和小伙伴们瞬间 ...

  2. HDU 题目分类收集

    并查集题型简单并查集1213 How Many Tables 1232 畅通工程 (杭电简单的并查集不是很多) 简单最小生成树1233 还是畅通工程 1863 畅通工程 1874 畅通工程再续 187 ...

  3. GTW likes math(BC 1001)

    GTW likes math Accepts: 472 Submissions: 2140 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 1 ...

  4. Ubuntu中找到并杀死僵尸进程

    Ubuntu中产生zombie进程让人很懊恼啊.Windows中在任务管理器里直接找到无响应的进程并结束他就行了,但是ubuntu中需要用命令去解决. System information as of ...

  5. Lisp之根源

    原文:http://www.paulgraham.com/rootsoflisp.html 约翰麦卡锡于1960年发表了一篇非凡的论文,他在这篇论文中对编程的贡献有如 欧几里德对几何的贡献.1 他向我 ...

  6. 八大排序c++可运行精简版,一目了然

    #include <iostream> using namespace std; // 插入排序开始===================== void insert_sort(int a ...

  7. JavaScript prototype.js提升JavaScript开发效率

    参考链接:http://www.yiibai.com/prototype/ Prototype提供主要方法类别: Prototype概述 Prototype实用功能 Prototype实用方法 Pro ...

  8. HDOJ-1018 Big Number

    http://acm.hdu.edu.cn/showproblem.php?pid=1018 题意:给出一个数n,输出n的阶乘的位数 汗Σ( ° △ °|||)︴刚开始还准备上大数乘法 然而10000 ...

  9. Linux中查看是否是固态硬盘(SSD)

       最近在准备测试,需要看看哪些机器挂载的是ssd硬盘,Google了一圈看到了许多方法,但都云里雾里的,不知道怎么确定.ssd硬盘貌似使用的也是scsi接口,所以根据盘符的名称也是判断不出来的.最 ...

  10. formidable上传图片

    function uploadfiles(res, req){ var form = new formidable.IncomingForm(); form.parse(req,function(er ...