原创 掃描線

落谷 p5490 這裏直接講講代碼的思路:(胡扯下) 這裏從左往右掃 先將矩形的豎邊放到line結構體中,同時將矩形的兩個縱座標放到v數組中,v排序後,v[1]存第一小y座標值,v[2]存第二小y座標值,(這裏沒有去重,應該是在m

原创 hdu 1542 掃描線

代碼: #include <iostream> #include <algorithm> using namespace std; const int maxn = 300+5; double v[maxn]; // 線段 st

原创 hdu 5321 Beautiful Set(推式子+ 反演+組合)*

大牛博客:https://blog.csdn.net/FirstLucker/article/details/47128347 下面是看了大牛的博客後,自己依着思路推的 zstu的推式子: hdu的話,最後注意有2n=∑i=0n

原创 HDU_5528_Count a * b (推式子+積性函數)*

參考一位很牛的大佬博客:https://blog.csdn.net/firstlucker/article/details/49336427 https://www.cnblogs.com/edward108/p/7636856.

原创 2019南昌icpc網絡賽C.hello 2019 & codeforce 750E.New Year and Old Subsequence(線段樹+矩陣+dp思想)*

題目鏈接: C.hello 2019 cf 750E 先講講cf 750E, 首先安利下cf這場比賽的題解http://codeforces.com/blog/entry/49412 關於這題核心就在題解鏈接中的討論部分,當發現

原创 2019 ICPC南京網絡賽 E. K sum (莫比烏斯反演+杜教篩)*

題目鏈接:https://nanti.jisuanke.com/t/41302 Define function fn(k)=∑l1=1n∑l2=1n…∑lk=1n(gcd⁡(l1,l2,…,lk))2\displaystyle f

原创 hdu 6267 Master of Random(2017中國大學生程序設計競賽-杭州站)(每個結點在可以所有組成的樹上的深度之和-----找規律是個技術活)*

題目鏈接:hdu 6267 分析: :參考博文 沒做出來,搜了下規律。這規律估計我得運氣到頂才能發現o(╯□╰)o 規律: 如果n = 4; 0節點的貢獻是6 = 3! 1節點的貢獻是12 = 3!+ 3!/1 2節點的貢獻是1

原创 hdu 6265 Master of Phi(杭州ccpc題目)(積性函數+歐拉函數)*

題目鏈接:hdu 6265 分析: 這題和南京網絡賽的K Sum有點類似,不過這題沒那題複雜 先將∑d∣nφ(d)∗nd\sum_{d|n}\varphi(d)*\frac{n}{d}d∣n∑​φ(d)∗dn​ 中的d改成質因子

原创 codeforce 102215A

http://codeforces.com/gym/102215/problem/A 模擬題 從正向遍歷 #include <cstdio> #include <iostream> #include <cstring> #incl

原创 中國剩餘定理

定理:     設m1,m2,⋅⋅⋅,mnm_{1},m_{2},···,m_{n}m1​,m2​,⋅⋅⋅,mn​,是兩兩互素的n個正整數,記m=m1m2⋅⋅⋅mn,Mi=mmi,1≤i≤nm=m_{1}m_{2}···m_{n}

原创 codeforce 1185C2

From :http://codeforces.com/blog/entry/67829 模擬題 代碼: #include <bits/stdc++.h> using namespace std; const int T =

原创 poj 2828

題目鏈接 TLE代碼: #include <iostream> #include <cstdio> using namespace std; const int maxn=2e5+10; struct tr { int va

原创 Basic remains(計算餘數)

Description Given a base b and two non-negative base b integers p and m, compute p mod m and print the result as a ba

原创 公牛和母牛

公牛和母牛 Language: Bull Math Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 16656 Accepted: 8491 Descripti

原创 A+B

#include <iostream> #include <cstdio> #include <cstring> using namespace std; const int MAXLEN = 30; char *addition