随笔分类 - 高精度
摘要:problem给定一个整数n和k个变换规则(一位数可变换成另一个一位数)经过任意次的变换( 0 次或多次),能产生出多少个不同整数n 55 且 33 -> 66 则能产生234、534、264、564四种数solution一共有15种操作,说明一个数能变成多个不同的...
阅读全文
摘要:problemsolutioncodes#include#include#include#define maxn 100001using namespace std;int a[maxn], b[maxn], c[maxn];int main(){ string...
阅读全文
摘要:problemsolutioncodes//高精减法//高精度的本质,用长度无限的数组或字符串代替int//原理:模拟减法退位#include#include#includeusing namespace std;const int maxn = (int)1e6+1...
阅读全文
摘要:problemsolutioncodes#include#include#include#define maxn 1010using namespace std;int a[maxn],b[maxn],c[maxn];int main(){ string s1,...
阅读全文
摘要:problem给定一个n进制的数m每次进行如下操作:反转(比如把56变成65)后两数相加,得新数。求最少经过几步可以得到新数为回文数,超过30步输出Impossible!solution判断回文或者反转一个数可以用STL的reverse。两n进制数相加模拟高精即可(竖...
阅读全文
摘要:problemsolutioncodes#include#include#include#includeusing namespace std;struct Bigint{ vectors; int is_minus; Bigint(long lon...
阅读全文
摘要:problemn个人,每个人左手右手各写有一个数字。把n个人排成一列,每个人得到的奖金是前面所有人左手上数字的乘积除以自 己右手上的数字下取整。最小化每个人奖金的最大值。solution一、贪心: + 按左手数字乘右手数字从小到大排序 + 小的在前,大的在后二、证明:...
阅读全文