- 博客(10)
- 资源 (2)
- 收藏
- 关注
原创 [LightOJ](1236)Pairs Forming LCM ---- 唯一分解定理(质因数分解)
Find the result of the following code:long long pairsFormLCM( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) for( int j = i; j <= n; j++ ) if( lcm(i, j) ...
2018-06-22 19:39:47 290
原创 Codeforces Round #489 (Div. 2) ---- B. Nastya Studies Informatics (数学)
题目链接:http://codeforces.com/contest/992/problem/B题意: 给你一个范围[l,r],和x,y,让你求在范围内,满足gcd(a,b) = x,lcm(a,b) = y的数对(a,b)有多少个。思路: 普通人的枚举思路是过不了啊QAQ(来自超霸的藐视) 所以在超霸的讲解下,要懂得缩小枚举范围~ QVQ 首先,我们根据gcd和lcm的关系,可以推出...
2018-06-19 18:14:16 168
原创 Codeforces Round #486 (Div. 3) ---- C. Equal Sums (map的应用)
题目链接:http://codeforces.com/contest/988/problem/C题意: 给你k个序列,让你从中选两个序列,分别从两个序列中删除一个元素使得两个序列的和相等。输出删除的两个元素分别在第几个序列的第几个思路: 一开始写了一个极复杂的容器混合QAQ(不说了) 然后发现map的count可以很好地处理这个题。 来源: map和set两种容器的底层结构都是红黑树...
2018-06-14 22:56:23 102
原创 Codeforces Round #487 (Div. 2) ---- B.A Tide of Riverscape
题目链接:http://codeforces.com/contest/989/problem/B题意: 给你一个串S由可能由’1’, ‘0’, ‘.’这三种字符组成,其中’.’表示它可能为‘1’或者为‘0’。它让你保证这个串中按照每p为一个周期,只有存在一对s[i]和s[i+p]是不相同的字符。输出满足题意的任意一个答案即可。反思: 这个题就是需要注意的讨论好细节,被Hack 惨痛掉灰QA...
2018-06-12 12:54:20 117
原创 [LightOJ](1220)Mysterious Bacteria ---- 唯一分解定理(质因数分解)
Dr. Mob has just discovered a Deathly Bacteria. He named it RC-01. RC-01 has a very strange reproduction system. RC-01 lives exactly x days. Now RC-01 produces exactly p new deadly Bacteria where x = ...
2018-06-11 15:33:21 369
原创 [YTU](3273)吃鸡之团队合作 ---- BFS
Description暑假就要开始啦!小伙伴们又可以肆无忌惮的开黑吃鸡了喵!我们知道开黑吃鸡最重要的当然是团队合作了。在一个地图中,一个小队的玩家之间的距离不能太远,这样当队友遇到危险被击倒时才能保证有队友可以在足够的时间内赶过去。现在,我们有一个N*N的地图,其中“#”表示无法跨越的障碍物,其余符号均可通过,大写字母“A”-“Z”表示小队编号,队员在每个单位时间内只能上下左右移动一格(每个小...
2018-06-09 18:45:32 448
原创 [UVA](10200)Prime Time ---- 前缀和+素数
Euler is a well-known matematician, and, among many other things, he discovered that the formula n 2 + n + 41 produces a prime for 0 ≤ n < 40. For n = 40, the formula produces 1681, which is 41 ∗...
2018-06-07 19:51:59 208
原创 [UVA](11827)Maximum GCD ---- 暴力+ungetc()函数
Given the N integers, you have to find the maximum GCD (greatest common divisor) of every possible pair of these integers.InputThe first line of input is an integer N (1 < N < 100) that d...
2018-06-07 17:28:06 151
原创 [LightOJ](1245)Harmonic Number (II) ---- 调和级数(规律)
I was trying to solve problem ‘1234 - Harmonic Number’, I wrote the following codelong long H( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) res = res + n / i; ...
2018-06-05 20:59:07 223
原创 [LightOJ](1370)Bi-shoe and Phi-shoe ---- 欧拉函数与素数筛(规律)
Bamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He needs some bamboos for his students, so he asked his assistant Bi-Shoe to go...
2018-06-04 19:30:16 179
Bellman-Ford模板
2018-03-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人