原创 二叉樹先序遍歷,中序遍歷,後序遍歷

  二叉樹問題,根據先序序列輸入字符,然後輸出其先序遍歷,中序遍歷,後序遍歷。 #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct tre

原创 Satisfactory Pairs

Given a positive integer n, find and print the number of pairs of positive integers(a,b), where(a < b) , that exist

原创 快速冪

快速計算a^b 防止超時#include <bits/stdc++.h> using namespace std; long long powmod(int a, int b); int main() { int a, b;

原创 已知一棵二叉樹的中序遍歷和後序遍歷,求二叉樹的先序遍歷

#include <stdio.h> #include <stdlib.h> #include <string.h> struct node { int data; struct node *lchild,*rchild;

原创 並查集( Roads and Libraries locked)

The Ruler of HackerLand believes that every citizen of the country should have access to a library. Unfortunately, Hack

原创 kmp算法

自己整理的kmp算法,幫助自己理解。 關鍵是next算法。 #include <stdio.h> #include <stdlib.h> #include <string.h> char a[1000050], b[1000050];

原创 二叉樹:根據二叉樹的先序遍歷序列和中序遍歷序列,輸出該二叉樹的後序遍歷序列

#include <stdio.h> #include <stdlib.h> #include <string.h> struct node { int data; struct node *lchild,*rchild;

原创 校賽~校賽~

Problem Description SDUT 的校賽是從 2009 年開始的,康納每年看到比賽之後,往往就會喊一聲 “ma ji ya ba ku nai + 年份的縮寫”。比如說 2009 年就會說 “ma ji ya ba ku

原创 比較好的博客

歐拉函數http://blog.csdn.net/sentimental_dog/article/details/52002608 逆元:http://www.cnblogs.com/linyujun/p/5194184.html

原创 FatMouse and Cheese(記憶化搜索)

FatMouse and Cheese Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submissio

原创 線段樹模板

#include <iostream> #include <cstdlib> #include <cstdio> #define maxn 100005 #define mid (l+r)/2 using namespace std;

原创 賽後總結(2017—ICPC—亞洲區域賽瀋陽站)

  歷經兩天的比賽之後,人生第一場亞洲區域賽結束了,這次見識到了和其他學校大牛之間的差距,自己還是太菜了,也從比賽中暴露了一些問題,也學到了很多東西。   熱身賽   第一天下午是熱身賽,第一次在體育館中

原创 組合數取模

#include <bits/stdc++.h> using namespace std; const long long mod = 1e9+7; const int maxn = 1e5+10; typedef long long L

原创 素數篩

for(long long i = 2; i <= 1010000; i += 2) a[i] = 0; b[1] = 2; for(long long i = 3; i <= 1010000; i +=

原创 Goldbach`s Conjecture

Goldbach's conjecture is one of the oldest unsolved problems in number theory and in all of mathematics. It states: Eve