hdoj1212Big Number(大数)
来源:互联网 发布:js修改url参数 不刷新 编辑:程序博客网 时间:2024/06/01 08:01
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.
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 312 7152455856554521 3250
Sample Output
251521代码:#include<stdio.h>int main(){ char a[1005]; int b,c; while(scanf("%s %d",a,&b)!=EOF) { long long sum=0; for(int i=0;a[i]!='\0';i++) { sum=(sum*10+a[i]-'0')%b; } printf("%d\n",sum%b); } return 0;}思路:每一步都去余,防止爆掉
0 0
- hdoj1212Big Number(大数)
- HDoj1212Big Number(同余定理)
- HNOI2016 大数(number)<莫队>
- hdoj1018_Big Number(大数阶乘位数)
- HDOJ 1018 Big Number(大数)
- 杭电1018-Big Number(大数)
- Big Number(大数取余)
- Big Number-大数运算
- HNOI2016 大数(number)
- 求大数阶乘的位数(ACM Big Number问题)
- HDU 1212 Big Number(水题)大数取模
- HDU-#1212 Big Number(大数取模)
- NUMBER BASE CONVERSION(大数进制转换)
- HDU 1212 Big Number(简单的大数取模)
- hdoj 1212Big Number(大数取模)
- HDU 1212 Big Number(大数取模)
- hdoj Big Number 1212 (大数取余) 水
- HDOJ--1212(大数取余)(Big Number)
- Spring学习笔记<一>
- J2EE之基础篇
- poj 2565 Average is not Fast Enough! 水题
- 【leetcode题解】【回溯】【54】【M】Subsets II
- [test]图片
- hdoj1212Big Number(大数)
- 汇编总结
- [LeetCode]035-Search Insert Position
- myeclipse/eclipse修改默认的java代码风格
- Intellij IDEA安装golang插件
- cuda中矩阵相加编程
- java开发中文乱码总结
- hdoj1234开门人和关门人(结构体+sort)
- 设计模式——观察者模式