HDU-1016-Prime Ring Problemhttp://acm.hdu.edu.cn/showproblem.php?pid=1016基本的DFS,先打個素數表即可#include<stdio.h>#include<string.h>#include<stdlib.h>int prime[50];int visit[30];int num[30];int n;void init(){ int i,j;
ZOJ-3635-Cinema in Akibahttp://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4803有n個從1..n標號的座位,按時間順序給出每個客人來的時候是坐在第幾個空座位,最後給若干個詢問問第i號客人坐在哪裡線段樹即可,和POJ-2828-Buy
HDU-1195-Open the Lockhttp://acm.hdu.edu.cn/showproblem.php?pid=1195基本的BFS,對一個四位元,任選一位加1或減1,或交換相鄰的兩個數#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<queue>#include<cmath>using
ZOJ-3640-Help Me Escapehttp://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3640一隻吸血鬼,有n條路給他走,每次他隨機走一條路,每條路有個限制,如果當時這個吸血鬼的攻擊力大於等於某個值,那麼就會花費t天逃出去,否則,花費1天的時間,並且攻擊力增加,問他逃出去的期望#include<iostream>#include<cstdio>#include<cstring>#
HDU-1520-Anniversary partyhttp://acm.hdu.edu.cn/showproblem.php?pid=1520DFS,有些節點具有父子關係,要求具有父子關係的節點不能同時出現#include<iostream>#include<cstdio>#include<cstring>#define N 6001struct node //左二子右兄弟法建樹{ int parent; int child; int