原创 ZOJ3952 Fibonacci Sequence Chicken Edition 【模擬】

#include<bits/stdc++.h> using namespace std; void print(int n) { for(int i=0; i<n; i++) { printf("

原创 2017年團體程序設計天梯賽-總決賽 L1-6. 整除光棍

L1-6. 整除光棍 當時想用java寫,不過忘記Scanner怎麼用了,現在用模擬重新寫了一下 #include<bits/stdc++.h> using namespace std; int x; int get(int c

原创 Codeforces Round #370 (Div. 2) C. Memory and De-Evolution【dfs+想法】

剛開始想從(x,x,x)進過一些方法得到(y,y,y),但是想了好多方法都不行。後來發現反過來想比較簡單從(y,y,y)開始,按照三角形的要求得到下一個爲(2*y-1,y,y),然後一直這樣做下去。最後當三角形邊最小的長度大於x時

原创 bnu52308 We don't wanna work! 【模擬+set】

#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e5+10; int n,m; struct node { i

原创 hdu3911 Black And White 【線段樹+區間異或操作】

#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <vector> #include <queue> #i

原创 hdu5925 Coconuts 【離散化+bfs】

#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e5; struct node { int x,y; }p[1

原创 1123. Is It a Complete AVL Tree (30) 二叉搜索樹

#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <vector> #include <queue> #i

原创 hdu5787 K-wolf Number【數位dp】

#include<bits/stdc++.h> using namespace std; typedef long long ll; int num[20],k; ll dp[20][2048]; //dp[i][k] //i:數

原创 VIJOS P1037搭建雙塔 【雙塔DP】

dp[i][j]: 代表合理利用前i個水晶建造兩座塔,較高的塔比較低的塔高j時,較高的塔的高度。 每次轉移考慮三種情況,不選用第i個,或者分別放在較高的塔上、較低的塔上。 #include<bits/stdc++.h> usin

原创 hdu3294 Girls' research 【manacher算法】

#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e6+10; string t; char s[10],a[20000

原创 HDU 5893 List wants to travel 【線段樹+樹鏈剖分】

#include<bits/stdc++.h> using namespace std; typedef vector<int> VI; typedef unsigned long long ull; typedef long l

原创 hdu3853 LOOPS 【概率DP+期望問題】

#include<bits/stdc++.h> using namespace std; const int N=1024; int n,m; double dp[N][N],r[N][N],d[N][N],p[N][N]; i

原创 zoj3640 Help Me Escape 【概率DP+期望】

#include<bits/stdc++.h> using namespace std; double dp[20000+10]; int t[1024],f,k,mx,c[1024]; int main() { int

原创 Intel Code Challenge Final Round C. Ray Tracing【模擬】

#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll inf=1e15; const int N=1e6+10; struct d

原创 Codeforces Round #372 (Div. 2) C. Plus and Square Root【二分】

最簡單的解法應該是第i次時,當前的值爲i*(i-1),假設下一步時值爲(i+1) * i,然後應該加 (i+1) * (i+1) * i-i-1次。自己的想法是假設當前爲m,那麼要能開方且複合題意的話,要得到的值最小應該爲mi=(