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. JS控制文本框中的密码显示/隐藏功能

    <html> <head> <title>[荐]JS控制文本框中的密码显示/隐藏功能_网页代码站(www.6a8a.com)</title> <s ...

  2. Python学习笔记三,数组list和tuple

    list也就是列表的意思,可以存储一组数据集合,比如classmates=['zhangsan','lisi','123']每个数据用单引号包裹,逗号隔开.

  3. opencv学习之旅_绘制跟踪轨迹

    如何将运动物体的轨迹画出来 我的想法是先:用CAMSHIFT跟踪物体,这个函数会返回一个track_box,将box的中心提取出来,然后以这个中心在另外的图像上画出来,然后将这张图像处理,提取轮廓,提 ...

  4. javascript之Number

    一.构造函数 Number(value) new Number(value) 二.Number属性 1.Number.MAX_VALUE 返回能表示的最大数字. 2.Number.MIN_VALUE ...

  5. [PowerShell] Backup Folder and Files Across Network

    ## This Script is used to backup folder/files and delete the old backup files. ## Author: Stefanie # ...

  6. HDU 3308 LCIS(线段树单点更新区间合并)

    LCIS Given n integers. You have two operations: U A B: replace the Ath number by B. (index counting ...

  7. LeeCode-Roman to Integer

    Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 t ...

  8. poj 2411 新写法

    别以为我在刷水题.... 今天做了场srm,500pt想到了是dp但是无从下手,但是看了rng_58的神代码后顿觉海阔天空啊(盯着看了一个下午),相比于一年前的写法,真的是不忍直视啊, TC真是个好地 ...

  9. Linux中shell文件操作大全

    1.创建文件夹#!/bin/shmkdir -m 777 "%%1" 2.创建文件#!/bin/shtouch "%%1" 3.删除文件#!/bin/shrm ...

  10. Unity 安卓Jar包的小错误

    好久没写博客了,也就意味着好久没有学习了,近几天在搞Unity接入有米的SDk遇到了一点小错误,今天早上解决了,和大家分享下! 1,我们的目的是在在U3D中调用Android产生的Jar包,首先在Ec ...