原创 spoj 7001 VLATTICE - Visible Lattice Points(莫比烏斯反演)

Consider a N*N*N lattice. One corner is at (0,0,0) and the opposite one is at (N,N,N). How many lattice points are vi

原创 bzoj 2733: [HNOI2012]永無鄉(線段樹啓發式合併)

Description 永無鄉包含 n 座島,編號從 1 到 n,每座島都有自己的獨一無二的重要度,按照重要度可 以將這 n 座島排名,名次用 1 到 n 來表示。某些島之間由巨大的橋連接,通過橋可以從一個島 到達另一個島。如果從島

原创 大數模板 (kuangbin模板的修訂版)

以前直接用kuangbin的模板,發現一直過不了題,今天又做了一題,發現原來是減法函數裏有一個地方寫錯了,改正之後就可以了(不保證其他的沒有問題)。 #include<cstdio> #include<cstring> #include

原创 bzoj 2301 [HAOI2011]Problem b (莫比烏斯反演)

Description 對於給出的n個詢問,每次求有多少個數對(x,y),滿足a≤x≤b,c≤y≤d,且gcd(x,y) = k,gcd(x,y)函數爲x和y的最大公約數。 Input 第一行一個整數n,接下來n行每行五個整數,分

原创 SGU 115. Calendar (基姆拉爾森公式)

irst year of new millenium is gone away. In commemoration of it write a program that finds the name of the day of the

原创 SGU 124. Broken line(射線法判斷一個點是否在一個多邊形內)

There is a closed broken line on a plane with sides parallel to coordinate axes, without self-crossings and self-conta

原创 SGU 116. Index of super-prime(完全揹包+輸出路徑)

Let P1, P2, … ,PN, … be a sequence of prime numbers. Super-prime number is such a prime number that its current number

原创 SGU 125. Shtirlits(dfs)

There is a checkered field of size N x N cells (1 Ј N Ј 3). Each cell designates the territory of a state (i.e. N2 st

原创 Manthan, Codefest 17 E. Salazar Slytherin's Locket(數位DP)

Harry came to know from Dumbledore that Salazar Slytherin's locket is a horcrux. This locket was present earlier at

原创 Codeforces Round #433 C. Planning(貪心)

Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that mu

原创 2017 廣西邀請賽&& hdu 6191 Query on A Tree(字典樹啓發式合併)

Problem Description Monkey A lives on a tree, he always plays on this tree. One day, monkey A learned about one of t

原创 Manthan, Codefest 17 C. Helga Hufflepuff's Cup(樹形DP)

  Harry, Ron and Hermione have figured out that Helga Hufflepuff's cup is a horcrux. Through her encounter with Bellatr

原创 Codeforces Round #433 D. Jury Meeting

Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should

原创 Codeforces Round #436 (Div. 2) E. Fire(01揹包+輸出路徑)

Polycarp is in really serious trouble — his house is on fire! It's time to save the most valuable items. Polycarp es

原创 Codeforces Round #435 (Div. 2) C. Mahmoud and Ehab and the xor

Mahmoud and Ehab are on the third stage of their adventures now. As you know, Dr. Evil likes sets. This time he won'