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. 【6】使用nginx

    sudo vim /etc/nginx/nginx.conf user root; worker_processes 2; error_log /var/log/nginx/error.log; pi ...

  2. c++基础五个题(二)

    一.c++中static的作用 1.隐藏:当同时编译多个文件时,所有未加static前缀的全局变量和函数都具有全局可见性,static函数作用就是为了隐藏 2.可以保持变量的持久:存储在静态数据区的变 ...

  3. Hibernate配置属性

    Hibernate配置属性 属性名 用途 hibernate.dialect 一个Hibernate Dialect类名允许Hibernate针对特定的关系数据库生成优化的SQL. 取值 full.c ...

  4. nodejs 如何使用upgrade,并且C/B 发送消息

    1 const http = require('http'); const querystring = require("querystring"); var postData = ...

  5. Socket也有专门的Unicode版本

    https://www.chilkatsoft.com/refdoc/wcppCkSocketWRef.html https://www.chilkatsoft.com/refdoc/vcCkSock ...

  6. HttpWebRequest.Method 属性

    public static void GetHead(string url) { var http = (HttpWebRequest)WebRequest.Create(url); http.Met ...

  7. Clone使用方法详解【转载】

    博客引用地址:Clone使用方法详解 Clone使用方法详解   java“指针”       Java语言的一个优点就是取消了指针的概念,但也导致了许多程序员在编程中常常忽略了对象与引用的区别,本文 ...

  8. MyCat 介绍、分片规则、调优的内容收集

    一.MyCat的简介 MyCat高可用.负载均衡架构图: 详细知识点:  MySQL分布式集群之MyCAT(一)简介(修正) 二.MyCat的schema.xml讲解 详细知识点:MySQL分布式集群 ...

  9. HDU-1016-素数环

    /* 将1-n个数放在环中,保证相邻的两个数的和是素数 第一个数字永远是1 就这两个约束条件 第一个难点是计算素数: 参考文献: http://c.biancheng.net/cpp/html/254 ...

  10. Xshell不能连接SSH的解决

    异常处理汇总-服 务 器 http://www.cnblogs.com/dunitian/p/4522983.html 重新启动看看:/etc/init.d/ssh restart (/etc/ini ...