Big Number hd 1212
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
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 <stdio.h>
#include <string.h>
int main()
{
int wbx,i,pp,l;
char cc[5200];
while(scanf("%s%d",cc,&wbx)!=EOF)
{
pp=0;
l=strlen(cc);
for(i=0;i<l;i++)
{
pp=pp*10+cc[i]-'0';
pp%=wbx;
}
printf("%d\n",pp);
}
return 0;
}
相關文章
- 1212. 地宮取寶
- Vue.js 父子元件通訊的1212種方式Vue.js元件
- JavaScript Number()JavaScript
- Picture hd 2052
- Kata:Hamming number
- JavaScript Number toLocaleString()JavaScript
- JavaScript Number toString()JavaScript
- Number.NaNNaN
- JavaScript Number 物件JavaScript物件
- Leetcode Number of islandsLeetCode
- 密碼 hd 2043密碼
- the Sum of Cube hd 5053
- 不要62 hd 2089
- [BUG反饋]升級遇問題1103升1212 -step3.htmlHTML
- 統計母音 hd 2027
- 字串統計 hd 2017字串
- 偶數求和 hd 2015
- 剪花布條hd 2087
- 1sting hd 1865
- A + B Problem II hd 1002
- 母牛的故事 hd 2018
- 18歲生日 hd 1201
- 美素數 hd 4548
- 素數判定 hd 2012
- 又見GCD hd 2504GC
- C# split big file into small files as, and merge the small files into big oneC#
- Perfect Number 完美數
- [LeetCode] Third Maximum NumberLeetCode
- [LeetCode] Find the Duplicate NumberLeetCode
- Leetcode 9 Palindrome NumberLeetCode
- Number.parseInt() 方法
- Number.parseFloat()方法
- Number.isSafeInteger()方法
- Number.isNaN()方法NaN
- Number.isFinite()方法
- Js中的NumberJS
- Number.POSITIVE_INFINITY
- Number.ATIVE_INFINITY