原创 codeforces/#305 Div1/547/B Mike and Feet
B. Mike and Feet time limit per test 1 second memory limit per test 256 megabytes input standard input o
原创 二分回顧
lower = lower_bound(a,a+n,3); upper = upper_bound(a,a+n,3); for(int i=lower;i<upper;i++) cout<<a[I]<<' '; //output -*-
原创 codeforces/#305 Div1/547/C Mike and Foam 【容斥】
C. Mike and Foam time limit per test 2 seconds memory limit per test 256 megabytes input standard input
原创 CF 552-C. Vanya and Scales
http://codeforces.com/problemset/problem/552/C C. Vanya and Scales time limit per test 1 second memory limit per tes
原创 hdu5365 判斷四個點是否構成正方形
問題描述 小花是一個熱愛健身的姑娘,這天她下載了一個跑步軟件,這個軟件可以記錄下小花跑步的軌跡。小花決定去公園跑步。公園裏有許許多多的座椅,小花希望在一些座椅休息一下,並且她在兩條座椅之間只跑直線。小花是一個完美主義者,她希望自己最後的軌
原创 高效位運算 __builtin_系列函數
•int __builtin_ffs (unsigned int x) 返回x的最後一位1的是從後向前第幾位,比如7368(1110011001000)返回4。 •int __builtin_clz (unsigned int
原创 揹包問題總結
一:01揹包 題目描述:N件物品放入容量爲V的包裹中,第i件物品體積Ci,價值Wi。怎麼裝可以使價值和最大。 方法:時間複雜度O(VN),空間複雜度O(V) 定義F[v]爲前i件物品放入容量v的揹包中
原创 CF 551DGukiZ and Binary Operations 矩陣/位運算
D. GukiZ and Binary Operations time limit per test 1 second memory limit per test 256 megabytes input s
原创 hdu 5072 容斥
Coprime Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 1123
原创 summary of SET/MAP
set 一些歸納 set能夠在O(logN)添加,刪除,檢查一個元素是否存在。 O(1)統計不一樣的元素的個數,也就是set裏元素的個數。 注意set每種元素只存放一次,也就是說s.insert(1)後,再s.insert(
原创 大數a*b%m a^b%m
ll motil(ll a, ll b , ll m) //a*b%m { ll ans=0; while(b){ if(b&1){ ans=(ans+a)%m; } b>>=1;
原创 Trie字典樹【模板
劉汝佳版本字典樹 #include <cstring> #include <vector> #include <cstdio> using namespace std; //********************************
原创 ZOJ 3865 Superbot
ZOJ 3865 Superbot Superbot Time Limit: 2 Seconds Memory Limit: 65536 KB Superbot is an interesting game which y
原创 析取範式變主析取範式
#include <cstdio> #include <iostream> #include <cmath> #include <cstring> using namespace std; const int n = 3; //n爲變元個
原创 數論
歐拉函數 歐拉函數Phi(x)等於不超過x,且和x互質的整數的個數。 歐拉公式爲 eg: phi(10)=4 1 2 3 4 5 6 7 8 9 int euler_phi(int n) {