原创 Linux添加Qt庫的方法

阿里雲服務器上添加Qt庫的方法(會自動根據當前已安裝的版本下載對應版本): sudo apt-get install libqt5websockets5-dev會安裝libqt5websockets5.so

原创 Safest Buildings(思維模擬)

ZOJ - 3993 PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute

原创 Almost Prime Numbers(素數篩)

UVA10539 枚舉2到high\sqrt{high}high​,分別看i2,i3⋯ini^2,i^3\cdots i^ni2,i3⋯in,是否在[left,right][left,right][left,right]中,統計

原创 Sum of Consecutive Prime Numbers(前綴和,素數篩)

UVA1210 篩出素數,處理成前綴和,O(n2)O(n^2)O(n2)枚舉每一種和的可能。 #include <iostream> #include <algorithm> #include <cmath> #include

原创 Minimum Sum LCM

UVA10791 思路: 由N=lcm(a,b)=abgcd(a,b)N=lcm(a,b)=\frac{ab}{gcd(a,b)}N=lcm(a,b)=gcd(a,b)ab​可知,當且僅當gcd(a,b)=1gcd(a,b)=1

原创 Perfect Pth Powers(唯一分解定理)

UVA10622 由唯一分解定理,將nnn分解後求每個素數項對應的指數的最小公約數即可。 雖然nnn在int範圍內,但仍要long long,因爲int的負數的絕對值比整數大1。 #include <iostream> #inc

原创 Pairs of integers

HDOJ 1554 You are to find all pairs of integers such that their sum is equal to the given integer number N and the

原创 Send a Table(歐拉函數埃式篩)

UVA10375 顯然,題目要求有多少二元組(x,y)(x,y)(x,y)滿足1≤x,y≤n且x,y互素1\leq x,y\leq n且x,y互素1≤x,y≤n且x,y互素。 根據歐拉函數ϕ\phiϕ的定義,ϕ(n)\phi (

原创 Divisors(約數的數目)

UVA294 題目要求指定範圍內約數數目最多的數以及對應的約數數量。 根據唯一分解定理,對於任意正整數2≤N2\leq N2≤N,有: N=∑i=1npiai,p爲素數N=\sum\limits_{i=1}^{n}p_i^{a_

原创 Choose and divide

Voj #include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <string.h> using namespac

原创 Plants vs. Zombies

ZOJ - 4062 BaoBao and DreamGrid are playing the game Plants vs. Zombies. In the game, DreamGrid grows plants to de

原创 Tournament(轉載)

ZOJ - 4063 DreamGrid, the king of Gridland, is making a knight tournament. There are nnn knights, numbered from 1

原创 Nature Reserve(三分)

CodeForces - 1059D 題目大意: 平面上有n個點,現在需要找這麼一個圓,它與y=0相切,且這n個點都在圓上或圓內,求這個圓的最小半徑Input輸入n,1 <= n <= 10^5 接下來n行,每行表示一個點的座標

原创 Forgery

CodeForces - 1059B time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandar

原创 Books

ZOJ - 4067 DreamGrid went to the bookshop yesterday. There are nnn books in the bookshop in total. Because DreamGr