自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

WangMeow --- ᶘ ᵒᴥᵒᶅ ฅ^•ﻌ•^ฅ

欲穷算法千里目,更上编程一层楼!

  • 博客(13)
  • 资源 (2)
  • 收藏
  • 关注

原创 [LightOJ](1282)Leading and Trailing ---- double快速幂

You are given two integers: n and k, your task is to find the most significant three digits, and least significant three digits of nk.InputInput starts with an integer T (≤ 1000), denoting the n...

2018-05-29 21:46:17 139

原创 [LightOJ](1138)Trailing Zeroes (III) ---- 二分

You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 1*2*…*N. For example, 5! = 120, 120 contains one zero on the trail...

2018-05-29 20:44:16 114

原创 [HDU](5446)Unknown Treasure ---- 组合数学(卢卡斯定理)+CRT

On the way to the next secret treasure hiding place, the mathematician discovered a cave unknown to the map. The mathematician entered the cave because it is there. Somewhere deep in the cave, she fou...

2018-05-28 21:37:59 178

原创 [HDU](5698)瞬间移动 ---- 组合数学(组合数)

有一个无限大的矩形,初始时你在左上角(即第一行第一列),每次你都可以选择一个右下方格子,并瞬移过去(如从下图中的红色格子能直接瞬移到蓝色格子),求到第n行第m列的格子有几种方案,答案对1000000007取模。 Input多组测试数据。 两个整数n,m(2≤n,m≤100000) Output一个整数表示答案Sample Input4 5Samp...

2018-05-23 21:13:14 848 1

原创 [POJ](2891)Strange Way to Express Integers ---- 数论(线性同余方程组)

Elina is reading a book written by Rujia Liu, which introduces a strange way to express non-negative integers. The way is described as following: Choose k different positive integers a1, a2, …, ak. F...

2018-05-22 21:12:29 153

原创 [POJ](1006)Biorhythms ---- 数论(中国剩余定理)

Some people believe that there are three cycles in a person’s life that start the day he or she is born. These three cycles are the physical, emotional, and intellectual cycles, and they have periods ...

2018-05-17 21:16:44 116

原创 [51Nod](1079)中国剩余定理 ---- 数论

一个正整数K,给出K Mod 一些质数的结果,求符合条件的最小的K。例如,K % 2 = 1, K % 3 = 2, K % 5 = 3。符合条件的最小的K = 23。Input第1行:1个数N表示后面输入的质数及模的数量。(2 <= N <= 10) 第2 - N + 1行,每行2个数P和M,中间用空格分隔,P是质数,M是K % P的结果。(2 <= P <...

2018-05-17 18:39:59 124

原创 Codeforces Round #481 (Div. 3) ---- E. Bus Video System(思维)

题意: 有n个站点,汽车的容量是w 现在给你每个站点,上车前和上车后人数的变化ai(1<=i<=n) 让你求一开始车上有人的情况有多少种。如果没满足题意,输出0思路: 利用前缀和,求前缀和最大mx,前缀和最小mn, 前缀和最大就是说,只有<=w-mx的人数才可以 ,即上限 前缀和最小就是说,当变化ai为负时,说明人数已经要>=mn 即下限AC代码:...

2018-05-13 21:23:49 492

原创 Codeforces Round #481 (Div. 3) ---- C. Letters (前缀和)

题意: 给你n个宿舍,其中每个宿舍都有ai个房间(1<=i<=n) ,房间从第一个宿舍起,编号从1到a1+a2+……+an. 然后给你m封信,bj(1<=j<=m) 表示给编号bj的房间的信。现在让你输出每封信属于哪个宿舍,以及所在那个宿舍的房间编号。思路: 使每封信都有一个前缀编号,这个前缀编号是它前面的一个房间的编号,这样就方便O(1)就可以求每封信了。 复...

2018-05-13 21:12:02 259

原创 Codeforces Round #479 (Div. 3) ---- D. Divide by three, multiply by two (DFS)

题意: 给你一个序列,然后利用这个序列中的元素重新组成一个新的序列,其中每相邻的两个元素具有两种关系的一种,例如x,y 满足 x/3 = y 或 x*2 = y思路: 爆搜,对于每一个元素AC代码:#include<bits/stdc++.h>using namespace std;#define rep(i,s,e) for(int i=s;i&l...

2018-05-13 20:57:02 133

原创 Codeforces Round #479 (Div. 3) ---- B.Two-gram

题意: 找一个出现次数最多的长度为2的子串AC代码:#include<bits/stdc++.h>using namespace std;#define rep(i,s,e) for(int i=s;i<=e;i++)#define rev(i,s,e) for(int i=e;i>=s;i--)#define a

2018-05-13 20:48:32 164

原创 【The 2017 BAPC】C题-Collatz Conjecture ---- GCD+优化去重

题意: 给你一个大小为n的序列,让你求里面所有子串的GCD,求里面最多有多少不同的GCD。思路: 利用集合set–tmp维护 到当前子串的最后一个元素的所有GCD,set–ans保存所有不同种类的GCD。 分析一下为什么不会超时,一开始以为这个算法很暴力,觉得是O(n^2 * logn) 其实,我们猜想最暴力的情况 即,1 ,2 , 4, 8 ,16,…… ,2^n 这组数据,我们会以...

2018-05-02 18:36:05 494

原创 [HDU](6025) Coprime Sequence ---- 前缀GCD+后缀GCD

Problem DescriptionDo you know what is called “Coprime Sequence”? That is a sequence consists of n positive integers, and the GCD (Greatest Common Divisor) of them is equal to 1. “Coprime Sequence”...

2018-05-01 20:10:23 180

Bellman-Ford模板

Bellman-Ford模板 Bellman-Ford模板 Bellman-Ford模板 Bellman-Ford模板 Bellman-Ford模板

2018-03-15

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除