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
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4. int main()
  5. {
  6. int n,i,j;
  7. char a[];
  8. while(cin>>a>>n)
  9. {
  10. int count=,c=,m=;
  11. count=strlen(a)-;
  12. for(i=;i<=count;i++)
  13. {
  14. m=a[i]-''+c*;
  15. c=m%n;
  16. }
  17. cout<<c<<endl;
  18. memset(a,,sizeof(a));
  19. }
  20. }

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. fence repair(队列水过)

    Fence Repair Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 32916   Accepted: 10638 点我 ...

  2. 使用Calendar增加日期

    /** * @Description: 当前日期加上n个月返回long date */ public static long getLongDateAddMonth(int n){ Calendar ...

  3. 【Razor语法规则小手册....】

    在经过长达半年的Windows开发后,Razor的一些语法有些生疏了.搜集些,再熟悉下.呵呵,甚是怀念以前做web 项目的时候,基于动软代码生成器自定义T4模板,后来vs2010后开始支持T4模板. ...

  4. 【转】Android下编译jni库的二种方法(含示例) -- 不错

    原文网址:http://blog.sina.com.cn/s/blog_3e3fcadd01011384.html 总结如下:两种方法是:1)使用Android源码中的Make系统2)使用NDK(从N ...

  5. VC断点不可用的问题

    文章一 今天我笔记本的VC编译器莫名其妙的就进入不了断点了,而台式机确是好的,问题是一进入调试,断点就自动被取消了,郁闷了一下午,无法进入断点的原因很多,都有想重装VC编译器的打算了,晚上回来查查资料 ...

  6. MongoDb Windows linux平台环境及主流编程语言驱动安装同时配置mongoDb的远程连接

    <一,>MongoDB 简介篇Ruiy; MongoDB是一个高性能,开源,无模式的文档型数据库,是当前NoSql数据库中比较热门的一种.它在许多场景下可用于替代传统的关系型数据库或键/值 ...

  7. hibernate多对一的操作解析

    在hibernate的关联操作中有很多关系,其中多对一关系是最常见的.我们看这两个表. 这里有部门表和员工表. 那么我们可以这么说一个部门可以有多个员工.这就是1对多的关系.这是我们站在部门表的角度上 ...

  8. IOS 添加到通讯录

    addressBookHelper.h #import <Foundation/Foundation.h> enum { ABHelperCanNotConncetToAddressBoo ...

  9. Dice Notation(模拟)

    Dice Notation Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit  ...

  10. 用Unity做的一个小游戏,仿照一个样例写的,个人认为文章写的不错,哈哈