Big Number HDU - 1212】的更多相关文章

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…
Minimum Inversion Number HDU - 1394 求最小反转数,就是求最少的逆序对. 逆序对怎么求,就是先把所有的数都初始化为0,然后按照顺序放入数字,放入数字前查询从这个数往后面的数的位置是不是被占了,被占了说明有逆序对. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <algorithm> #define debug(n) printf(&qu…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1212 Big Number 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…
Big Number 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1212 ——每天在线,欢迎留言谈论. 题目大意: 给你两个数 n1,n2.其中n1 很大很大,n1%n2的值. 知识点: ①秦九韶公式:例:1314= ((1*10+3)*10+1)*10+4 ②(a*b)%c == (a%c)*(b%c) .(a+b)%c == (a%c)+(b%c) . 思路: 每步取模即可. C++ AC代码: #include <iostream> #…
http://acm.hdu.edu.cn/showproblem.php?pid=1212 题目大意: 给你一个长度不超过1000的大数A,还有一个不超过100000的B,让你快速求A % B. 什么?你说用大数的模板?那太慢了! 思路: 举个例子,1314 % 7= 5 由秦九韶公式: 1314= ((1*10+3)*10+1)*10+4 所以有 1314 % 7= ( ( (1 * 10   % 7  +3 )*10  % 7   +1)*10  % 7 +4   )%7 #include…
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 t…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=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…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5062 题目意思:给出 N,找出 1 - 10^N 中满足 Beautiful Palindrome Numbers (BPN)的数量有多少. 满足 BPN 的条件有两个:(1)回文串   (2)对称的部分从左到右递增排放. (1)版本 1 (比较麻烦,建议看版本2)        46ms #include <iostream> #include <cstdio> #include &…
The inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i < j and ai > aj. For a given sequence of numbers a1, a2, ..., an, if we move the first m >= 0 numbers to the end of the seqence, we wil…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5981 题意:A在[L, R]之间随机选取一个数X,之后B来猜这个数,如果猜的数比X小,那么A就告诉B猜小了,如果猜的数大于X,那么以后A永远只会回答B是否猜对了,问在最坏的情况下B至少要猜多少次,并求出有多少种方案. 题解:参考自:https://blog.csdn.net/jaihk662/article/details/77435217     补充关于猜测次数的理解:如果第一次猜测的数大于等于…