随笔分类 - 数论
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=5976 题意:给你一个数n,拆成不同的几份,使乘积最大。 解法:从2开始拆 2 , 3 , 4 ....l , 最后会余下x , 0<=x <= l ; 再将x从后往前依次分配1给各元素。 1、x == l:3*4
阅读全文
摘要:CodeForces - 1154G 题意:求最小的lcm(a,b)的下标; #include <bits/stdc++.h> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <i
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=6576 题意:n个仓库m个工人,给出n个仓库的每天每个工人做ai件事,问如何分配m个工人到n个仓库,使得每一个仓库每天做相等数量的事。 解法:求出n个仓库的ai的lcm,lcm/a[i]为该仓库所需最小工人数,相加
阅读全文