原创 POJ 3279 Fliptile(枚舉+模擬)

Description Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has a

原创 POJ 3414 Pots(寬搜)

Description You are given two pots, having the volume of A and B liters respectively. The following operations can

原创 UVA-11624 Fire!(寬搜)

UVA-11624 Fire! Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the

原创 HDU - 2612 Find a way(寬搜)

Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have

原创 【模板】Floyd的優化

#include<iostream> #include<cstdio> #include<cstring> using namespace std; int dp[105][105]; int main() { int n

原创 【模板】中國剩餘定理解同餘方程(附_int128)

//問題:求解同餘方程組 // x ≡ a1 (mod b1) // x ≡ a2 (mod b2) // x ≡ a3 (mod b3) // ······ // x ≡ an (mod bn) //其中b1,b2,b3,··

原创 【模板】KMP

/*判斷字符串b是否是a的字串*/ #include<bits/stdc++.h> using namespace std; void GetNext(const char *p, int *next) { next[0] =

原创 【模板】超級冪(歐拉降冪)

題意:求a ^ a ^ a ^ a…(b次)對mod取模 #include<iostream> #include<cstdio> #include<cstring> using namespace std; long long

原创 POJ 1182 食物鏈 (並查集)

Language: 食物鏈 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 105746 Accepted: 32016 Description 動物王國中

原创 POJ 3254 Corn Fields(狀壓DP)

Description Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) sq

原创 HDU - 5056 Boring count(尺取)

HDU - 5056 You are given a string S consisting of lowercase letters, and your task is counting the number of substrin

原创 CodeForces - 1118F1 Tree Cutting (Easy Version) (樹上dfs)

Tree Cutting (Easy Version) You are given an undirected tree of n vertices. Some vertices are colored blue, some are

原创 求組合數(擴展歐幾里得+費馬小定理)

擴展歐幾里得: #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int mod=1e9+7; void exgcd(lo

原创 2019寒假訓練賽10解題報告

A - Bungee Jumping POJ - 2463 題意:有一個人要用一段繩子來跳樓,現在給你繩子的彈性係數、繩子的長度、樓的高度和人的質量,根據物理知識判斷這個人是會摔死、還是安全着陸、還是被掛在半空(如果下落速度超過10m

原创 山東省第一屆ACM大學生程序設計競賽——Ivan comes again!(set+二分)

Problem Description The Fairy Ivan gave Saya three problems to solve (Problem F). After Saya finished the first probl