原创 UVA 3644 X-Plosives

#include<bits/stdc++.h> using namespace std; int fat[100010]; int find(int x){ if(fat[x]==0)return x; return fat[x]=f

原创 Vijos 生產產品

描述在經過一段時間的經營後,dd_engi的OI商店不滿足於從別的供貨商那裏購買產品放上貨架,而要開始自己生產產品了!產品的生產需要M個步驟,每一個步驟都可以在N臺機器中的任何一臺完成,但生產的步驟必須嚴格按順序執行。由於這N臺機器的性能

原创 POJ 2480 Longge's problem

#include<cstdio> using namespace std; typedef long long ll; ll p[6010],prime[50010]; ll l,d,ans,s[20],k[20],b[20]; void

原创 UVA 11082 Matrix Decompressing

#include<bits/stdc++.h> using namespace std; int r,c,a[30],b[30],pre[50],h[50][50]; bool vis[50]; int bfs(int s,int t){

原创 POJ 1845 Sumdiv

#include<cstdio> using namespace std; typedef long long ll; const int M=9901; ll p[100],k[100]; ll power(ll n,ll m){ l

原创 POJ 2992 Divisors

#include<cstdio> using namespace std; const int M=431; bool b[M+5]; int l,p[M+5],jie[M+5][M+5]; void jc(){ int i,j; f

原创 UVA11732 "strcmp()" Anyone?

#include<bits/stdc++.h> using namespace std; struct node{ int m,son[70]; }p; vector<node>f; int zh(char c){ if(

原创 UVA 3027 Corporative Network

#include<bits/stdc++.h> using namespace std; struct node{ int fat,dis; }a[20010]; int find(int x){ if(a[x].fat==x)ret

原创 Tyvj1305

描述 • 輸入一個長度爲n的整數序列,從中找出一 段不超過M的連續子序列,使得整個序列的 和最大。   例如 1,-3,5,1,-2,3  當m=4時,S=5+1-2+3=7 當m=2或m=3時,S=5+1=6  輸入格式 第一行兩個數n

原创 UVA 3942 Remember the Word

#include<cstdio> #include<cstring> const int M=400010,mod=20071027; char a[M],s[110]; int l,d[M],son[M][30]; bool h[M];

原创 統計難題

Ignatius最近遇到一個難題,老師交給他很多單詞(只有小寫字母組成,不會有重複的單詞出現),現在老師要他統計出以某個字符串爲前綴的單詞數量(單詞本

原创 UVA 11235 Frequent values

#include<bits/stdc++.h> using namespace std; const int M=100010; int a[M],p[M],s[M],dp[M][20]; int rmq(int x,int y){ i

原创 ZOJ 2760 How Many Shortest Path

#include<queue> #include<cstdio> #include<vector> #include<cstring> using namespace std; const int M=110,inf=0x3f3f3f3f

原创 HDU 4864 Task

#include<bits/stdc++.h> using namespace std; const int M=100010; struct node{ int x,y; }a[M],b[M]; int p[110]; int

原创 BZOJ 2140 穩定婚姻

#include<bits/stdc++.h> using namespace std; const int N=10000; stack<int>s; map<string,int>mp; vector<int>a[N]; bool c