原创 ural 1126. Magnetic Storms
Magnetic Storms #include <cstdio> #include <iostream> #include <queue> using namespace std; struct Node
原创 例題6.3.1
小球下落 #include<stdio.h> #include<string.h> const int MAXD=20; int s[1<<MAXD]; int main() { int D, I; while(scanf("%d
原创 poj 1028.Web Navigation
Web Navigation #include<iostream> #include<string> #include<stack> using namespace std; #define ACM "http://www.acm.org
原创 hdoj 1213.How Many Tables
How Many Tables #include<iostream> #include<cstdio> using namespace std; const int MAXN=1000+10; int n,father[MAXN]; vo
原创 hdoj 1856.More is better
More is better #include<iostream> #include<cstdio> using namespace std; const int MAXN=10000000+10; int n,father[MAXN],
原创 zoj 3114.Double Queue
Double Queue #include<iostream> #include<cstdio> #include<map> using namespace std; int main() { map<int,int >mp; ma
原创 例題7.4.2
素數環 #include<iostream> #include<cmath> #include<algorithm> using namespace std; const int MAXN=40; int isp[MAXN]; int
原创 ural 1654. Cipher Message
Cipher Message #include<iostream> #include<cstdio> #include<stack> using namespace std; const int MAXN=200000+10; sta
原创 例題7.4.3
困難的串 #include<iostream> using namespace std; const int MAXN=80; int n,L,cnt; int S[MAXN]={0}; int dfs(int cur) { if(cn
原创 例題6.3.2
層次遍歷 #include <iostream> #include <string> #include <sstream> using namespace std ; const int MAXN = 256 ; c
原创 例題5.2.1
小學生算術 #include<stdio.h> int main() { int a, b; while(scanf("%d%d",&a,&b)==2){ if(!a&&!b){ break; } int c=0,
原创 例題5.4.3
果園裏的樹 #include<stdio.h> #include<math.h> double doubleArea(double x0, double y0, double x1, double y1, double x2, doub
原创 例題5.4.2
因子和階乘 #include<stdio.h> #include<string.h> int isPrime(int x) { for(int i=0;i*i<=x;i++){ if(x%i==0){ return 0;
原创 例題6.1.1
卡片遊戲 #include<iostream> using namespace std; #define MAX 100 int n; int queue[MAX];//數組定義爲2倍大小,否則讀寫非法內存 int begin; int
原创 例題6.4.1
黑白圖像 #include<stdio.h> #include<string.h> const int MAXN=256; int mat[MAXN][MAXN], vis[MAXN][MAXN]; void dfs(int x,i