【51nod 1678】 lyk与gcd(容斥、筛法)

基准时间限制:2 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 这天,lyk又和gcd杠上了。 它拥有一个n个数的数列,它想实现两种操作。 1:将 ai 改为b。 2:给定一个数i,求所有 gcd(i,j)=1 时的 aj 的总和。 Input 第一行两个数n...

2018-09-29 19:48:38

阅读数 149

评论数 0

【HDU - 5468 】Puzzled Elena(容斥)

Since both Stefan and Damon fell in love with Elena, and it was really difficult for her to choose. Bonnie, her best friend, suggested her to throw a...

2018-09-14 14:47:11

阅读数 44

评论数 0

GCD Expectation ZOJ - 3868 (容斥)

Edward has a set of n integers {a1, a2,…,an}. He randomly picks a nonempty subset {x1, x2,…,xm} (each nonempty subset has equal probability to be pic...

2018-04-25 17:23:17

阅读数 54

评论数 0


这次在乌市现场赛的关键是D题和K题,就这两个问题来实际探讨一下。 就比赛前一刻,我突然想起前1到n的平方和1到n的平方和,然后我问东东通向公式是多少,最后我还是想起来,但是没想到,在比赛的时候还真的用着了。这是题外话,咳咳。 由于题目资源放在计蒜客平台上,而且要到明年2月才开放...

2017-12-16 22:50:59

阅读数 540

评论数 0

Color UVALive - 7040 (容斥+组合数)

Recently, Mr. Big recieved n owers from his fans. He wants to recolor those owers with m colors. The owers are put in a line. It is not allowed to c...

2017-10-24 23:38:25

阅读数 125

评论数 0

TrickGCD HDU - 6053(莫比乌斯函数与容斥的关系)

You are given an array AA , and Zhu wants to know there are how many different array BB satisfy the following conditions? 1≤Bi≤Ai For each pair( l ...

2017-10-22 15:26:28

阅读数 201

评论数 0

Sticks and Right Triangle HDU - 3939(毕达哥拉斯)

We have a stick with infinite length. Now we want to cut 3 sub-sticks with length x, y, z which is not large than L to form a right triangle. With un...

2017-09-29 19:08:53

阅读数 118

评论数 0

Lucky7 HDU - 5768(中国剩余定理+容斥定理)

When ?? was born, seven crows flew in and stopped beside him. In its childhood, ?? had been unfortunately fall into the sea. While it was dying, seve...

2017-09-03 14:09:47

阅读数 163

评论数 0

HDU 4135 Co-prime(容斥原理)

Given a number N, you are asked to count the number of integers between A and B inclusive which are relatively prime to N. Two integers are said to...

2017-07-19 14:44:36

阅读数 221

评论数 0

GCD HUD 1695(容斥原理)

Given 5 integers: a, b, c, d, k, you’re to find x in a…b, y in c…d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x and y. Since ...

2017-07-18 23:18:09

阅读数 166

评论数 0

取消 删除