
基本定理
Lngxling
这个作者很懒,什么都没留下…
展开
-
POJ - 1845 Sumdiv —— 因子和 等比数列求和
SumdivTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 25199 Accepted: 6244DescriptionConsider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo...原创 2018-04-16 22:50:56 · 312 阅读 · 0 评论 -
LightOJ - 1138 Trailing Zeroes (III)
题意:求最小的n的阶乘使得阶乘的末尾有q个0思路:阶乘末尾0的个数,即含有的5的倍数,求一次是log的复杂度,再二分一下#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>#include <queue>#inclu...原创 2018-08-30 14:04:09 · 257 阅读 · 0 评论 -
LightOJ - 1341 Aladdin and the Flying Carpet —— 算术基本定理
题意:给定一个矩形的面积和最短边长,边长都是正整数,问矩形有多少种可能的形状思路:面积的所有因子的个数/2就是所有的x*y=s的对数,用算术基本定理求出所有的因子个数,然后减掉小于最短边长的部分一是要特判0的情况,二是要用longlong#include <bits/stdc++.h>#define ll long longusing namespace std;...原创 2018-08-01 18:42:39 · 183 阅读 · 0 评论 -
LightOJ - 1370 Bi-shoe and Phi-shoe —— 欧拉函数
题意:给定n个数,对每个数求出一个数使得这个数的欧拉函数值大于这个数,求这些数的和思路:素数的欧拉值是最大的,满足题意的数一定是素数欧拉筛得到1e6内的所有素数,二分查找每个输入数的位置,相加即可#include <iostream>#include <cstdio>#include <algorithm>#include <cst...原创 2018-08-01 18:31:05 · 189 阅读 · 0 评论 -
HDU - 1792 A New Change Problem
A New Change ProblemTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1610 Accepted Submission(s): 1024Problem DescriptionNow given two kinds o...原创 2018-05-05 21:44:10 · 245 阅读 · 0 评论 -
POJ - 2142 The Balance —— 扩展欧几里得
The BalanceTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 8159 Accepted: 3560DescriptionMs. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine. Fo...原创 2018-05-05 21:39:17 · 238 阅读 · 0 评论 -
POJ - 1305 Fermat vs. Pythagoras —— 毕达哥拉斯三元组
Fermat vs. PythagorasTime Limit: 2000MS Memory Limit: 10000KTotal Submissions: 1651 Accepted: 965DescriptionComputer generated and assisted proofs and verification occupy a small niche in the realm of...原创 2018-05-05 21:34:14 · 255 阅读 · 0 评论 -
HDU - 3939 Sticks and Right Triangle —— 毕达哥拉斯三元组
Sticks and Right TriangleTime Limit: 12000/4000 MS (Java/Others) Memory Limit: 65535/65536 K (Java/Others)Total Submission(s): 793 Accepted Submission(s): 314Problem DescriptionWe have a stick w...原创 2018-05-05 21:28:22 · 338 阅读 · 0 评论 -
POJ - 2689 Prime Distance —— 二次筛
Prime DistanceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 20935 Accepted: 5629DescriptionThe branch of mathematics called number theory is about properties of numbers. One of the areas t...原创 2018-05-05 21:18:01 · 256 阅读 · 0 评论 -
ACM-ICPC 2018 南京赛区网络预赛 J. Sum
题意:数n可以写成a*b的形式,使得a和b的所有因子都不是平方数,问前n个数,每个数可以拆分的方法数的和。思路:就不该去oeis的,oeis出来莫比乌斯,需要每个数所有因子的莫比乌斯乘积,是在给定时间内处理不了的由算术基本定理,每个数都可以写成素数幂乘积的形式,x=p1^k1*p2^k2*p3^k3...pn^kn那么由题意,如果存在k大于3,这个数就没办法拆分如果k=2,...原创 2018-09-02 14:58:48 · 371 阅读 · 0 评论