
数学
文章平均质量分 66
Joefery
生命不息,战斗不止。
展开
-
N!的位数两种方法求解
第一种方法:将n!表示成10的次幂,即n!=10^M 则不小于M的最小整数就是 n!的位数,对该式两边取对数,有 M =log10^n!即: M = log10^1+log10^2+log10^3...+log10^n 循环求和,就能算得M值,该M是n!的精确位数#include#include#include#includeusing namespace std;原创 2016-05-29 20:45:43 · 1227 阅读 · 0 评论 -
UVALive 7340 Sum of MSLCM【数学】
题目链接/* 题意:给定一个N,求从2~N的最小公倍数的和 类型:数学 分析:两种姿势可以A题,但是用时相差很大 1.用类似埃氏筛选法,处理出前缀和4000+ms 2.用类似因式分解的方法,分成两部分,sqrt(N)前和后,后的可以用求和公式,前的 用n/i*i求出来20ms*///第一种方原创 2016-10-26 01:35:35 · 1075 阅读 · 1 评论 -
与公约数有关的问题
第一道题是2015年浙江理工12月比赛的一道题4216: Jug HardDescriptionYou have two empty jugs and tap that may be used to fill a jug. When filling a jug from the tap, you can only fill it completely (i.e.,原创 2015-12-23 17:16:32 · 494 阅读 · 0 评论 -
codeforces 599D. Spongebob and Squares【推公式+暴力枚举】
D. Spongebob and Squarestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSpongebob is already tired trying原创 2016-08-30 20:26:39 · 701 阅读 · 0 评论 -
CSU 1803 2016 【枚举】
Description 给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量:1. 1≤a≤n,1≤b≤m;2. a×b 是 2016 的倍数。Input输入包含不超过 30 组数据。每组数据包含两个整数 n,m (1≤n,m≤10 9).原创 2016-09-05 00:00:19 · 836 阅读 · 0 评论 -
CodeForces - 630C Lucky Numbers【计数】
题目链接题意:定义只由7和8组成的数字为幸运数字,现给出一整数n,问位数不超过n位的数字中有多少个幸运数字找了好久,才发现规律 T_T 没救了。。ans=2+2^2+2^3+…+2^n=2*(2^n-1) #include#include#include#include#include#include#include#inc原创 2016-06-01 21:42:14 · 646 阅读 · 0 评论 -
codeforces #630 E. A rectangle 【数学】
题目链接推公式就好了,注意爆int#include#include#include#include#includeusing namespace std;int main(){ long long x0,y0,x,y; cin>>x0>>y0>>x>>y; cout<<((x-x0)/2+1)*((y-y0)/2+1)+(x-x0)*(原创 2016-07-13 12:56:58 · 607 阅读 · 0 评论 -
Codeforces 598A Tricky Sum【计数】
A. Tricky Sumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn this problem you are to calculate the sum o原创 2016-08-20 03:35:26 · 628 阅读 · 0 评论 -
codeforces 707 C Pythagorean Triples【数学】
C. Pythagorean Triplestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputKatya studies in a fifth grade. Recen原创 2016-08-21 03:23:28 · 1341 阅读 · 0 评论 -
LightOj 1045 N!位数的应用
Digits of FactorialTime Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %lluDescriptionFactorial of an integer is defined by the following functionf(0) = 1f(n) = f(n -原创 2016-05-29 21:41:27 · 544 阅读 · 0 评论 -
Gym 101138I Prime Moving【素数测试】
Descriptionstandard input/outputStatementsThe author of this problem hopes that you already know the pig called Benny.Recently she started learning numbers. The first type of numbers she h原创 2016-10-28 11:15:08 · 434 阅读 · 0 评论