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元件
- Picture hd 2052
- JavaScript Number()JavaScript
- 密碼 hd 2043密碼
- the Sum of Cube hd 5053
- 不要62 hd 2089
- JavaScript Number 物件JavaScript物件
- Leetcode Number of islandsLeetCode
- Kata:Hamming number
- JavaScript Number toLocaleString()JavaScript
- JavaScript Number toString()JavaScript
- Number.NaNNaN
- C# split big file into small files as, and merge the small files into big oneC#
- 統計母音 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
- [BUG反饋]升級遇問題1103升1212 -step3.htmlHTML
- Little Endian & Big Endian
- Big Data and Data Warehousing
- aix lvm big vgAILVM
- 想要升級Big Sur?你的Mac與Big Sur相容嗎?Mac
- Serial number lookup for Panasonic
- D. The Number of Imposters
- 7.104 ITERATION_NUMBER
- Leetcode 447 Number of BoomerangsLeetCodeOOM
- react input[type='number']React
- number(p,s)(轉)
- Last digit of a huge numberASTGit
- [HNU 10072] Fibonacci Number