- 博客(281)
- 问答 (1)
- 收藏
- 关注
原创 Python socket篇
1.安装: 2.文档: https://docs.python.org/3/library/socket.html 3. Client.py """ import socket HOST = "127.0.0.1" PORT = 3333 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.c
2017-03-29 13:38:15 411
原创 Python Optparse篇
安装: 1.直接安装就行了 window10 64 python 2.7 感觉并没有问题. 文档: 官方文档: https://docs.python.org/2/library/optparse.html 使用: #coding: utf-8 import optparse def main(): usage = "usage: %
2017-03-25 20:48:18 594
原创 Python Nmap篇
安装: window10 64 先安装的nmap 在安装的python2.6 和python3.5 经检验 python2.6 与 python nmap的包兼容性更高。 python3.5 好像是需要修改 nmap 的安装路径(就不告诉你怎么修改)(我会告诉你我其实也不会改)。 文档: 自带文档: nmap.html (在压缩包里) 官方文档:http://xael.
2017-03-24 20:38:31 3949
原创 汇编语言 计算 2^3 .
assume cs:codesg codesg segment mov ax,2 add ax,ax add ax,ax mov ax,4c00h int 21h codesg ends end
2017-03-02 10:27:31 1918
原创 蓝桥杯 方格填数 (强行暴力)
#include #include #include using namespace std; int a[15]; int judge() { for(int i=1;i<=10;i++) { if(abs(a[i]-a[i-4])==1&&i-4>=1) return 0; if(abs(a[i]-a[i+4])==1&&i+4<=10) re
2017-01-14 18:13:17 767
原创 51nod 1384 全排列 (dfs/next_permutation)
我胡汉三又回来了。 #include #include #include #include using namespace std; char a[15],ans[15]; int book[15]; int str; int dfs(int t) { if(t==str) { printf("%s\n",ans); return 0; }
2017-01-09 12:20:19 335
原创 哈尔滨理工大学软件学院 1450 经商 (易错并查集+01背包)
#include #include #include using namespace std; const int maxn=1e6+5; int fa[maxn]; int u[maxn]; int v[maxn]; int n,m,c; int T[maxn]; int dp[maxn]; int rank1[10005]; void init() { for(int i=1; i<
2016-11-21 20:57:39 138
原创 哈尔滨理工大学软件学院OJ 1451 经商(大树/ 斐波那契数列)
#include #include #include using namespace std; struct node { long long a[3][3]; }T; const int MOD=1000000007; node muli(node x,node y) { node temp; for(int i=1;i<=2;i++) { fo
2016-11-21 20:53:31 1508
原创 HDU 4508 湫湫系列故事——减肥记I (完全背包)
#include #include #include using namespace std; const int maxn=105; struct node { int a,b; }T[maxn]; int dp[100005]; int main() { int n; while(~scanf("%d",&n)) { memset(dp,0,s
2016-11-15 21:42:22 376
原创 HDU 2546 饭卡 (01背包)
#include #include #include using namespace std; int a[1005]; int dp[1005][1005]; int main() { int n; while(~scanf("%d",&n)) { if(n==0) return 0; memset(dp,0,sizeof(dp));
2016-11-15 21:12:55 281
原创 哈尔滨理工大学软件学院OJ 1419: 最大的XⅡ
#include #include #include using namespace std; int n,m; char maps[1005][1005]; int main() { while(~scanf("%d%d",&n,&m)) { for(int i=1; i<=n; i++) { scanf("%s",map
2016-11-14 17:41:57 1619
原创 HDU 1022 Train Problem I (stack)
#include #include #include #include #include #include #include using namespace std; char a[100005]; char b[100005]; stackQ1; stackQ2; int stra,strb; int judge() { stra=strlen(a),strb=strlen(b);
2016-11-10 18:24:37 293
原创 HDU 2094 产生冠军 (不重复集合set)
#include #include #include #include #include #include #include using namespace std; int main() { int t; while(~scanf("%d",&t)) { if(t==0) return 0; string a,b; s
2016-11-10 14:48:34 287
原创 PJ 2566 Bound Found (尺取法)
#include #include #include using namespace std; const int maxn=1e5+5; int n,k; pairE[maxn]; int solve(int x)//尺取法并不是简单的暴力 { int l=0,r=1; int dis=1e9+5,ui,op; int ans; while(l<=n&&r<=
2016-11-08 21:53:32 290
原创 POJ 3320 Jessica's Reading Problem (尺取法)
#include #include #include #include #include using namespace std; int a[1000005]; int main() { int t; while(~scanf("%d",&t)) { setT; mapE; for(int i=1; i<=t; i++)
2016-11-07 16:53:57 245
原创 HDU 5154 Harry and Magical Computer (Floyd)
#include #include #include using namespace std; int maps[105][105]; int n,m; int main() { while(~scanf("%d%d",&n,&m)) { memset(maps,0,sizeof(maps)); int flag=0; for(in
2016-11-06 21:48:28 345
原创 HDU 5154 Harry and Magical Computer (强连通分量)
#include #include #include #include #include using namespace std; const int maxn=1005; vectorG[maxn]; int pre[maxn],lowlink[maxn],sccno[maxn],dfs_clock,scc_cnt; stackS; int n,m; void dfs(int u)//大白的
2016-11-06 21:37:52 378
原创 HDU 5154 Harry and Magical Computer (拓扑排序)
#include #include using namespace std; int degree[505],res[505]; bool maps[505][505]; int n,m; void topo() //直接抄板子。 { int p; for(int i=1; i<=n; i++) { p=-1; for(int j
2016-11-06 15:40:53 334
原创 HDU 5154 Harry and Magical Computer (BFS)
#include #include #include #include using namespace std; int n,m; int maps[105][105]; int book[105]; int main() { while(~scanf("%d%d",&n,&m)) { memset(maps,0,sizeof(maps)); me
2016-11-06 00:30:01 323
原创 POJ Running (DP)
#include #include #include using namespace std; int a[100005]; int dp[100005][500]; int main() { int n,m; scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) { scanf("%d",&a[i]); }
2016-10-11 18:42:53 378
原创 POJ 2955 Brackets (区间DP)
#include #include #include using namespace std; char a[105]; int dp[105][105]; int main() { while(~scanf("%s",a)) { if(a[0]=='e') return 0; memset(dp,0,sizeof(dp)); in
2016-10-10 19:19:54 243
原创 POJ 1651 Multiplication Puzzle (区间DP/矩阵链乘优化)
#include #include #include using namespace std; int a[105]; int dp[105][105]; int main() { int n; scanf("%d",&n); //memset(dp,0,sizeof(dp)); for(int i=1;i<=n;i++) { scanf("%d"
2016-10-09 21:29:34 328
原创 HDU 5900 QSC and Master (区间DP)
#include #include #include using namespace std; #define ll long long ll ai[305],val[305]; ll dp[305][305]; ll sum[305]; int gcd(ll a,ll b) { if(b==0) return a; else return gcd(b,a%b); } int
2016-10-09 19:12:42 240
原创 HDU 1523 Drainage Ditches (网络流/dinic/模板)
#include #include #include using namespace std; const int maxn=1e6; struct Edge { int a,b,c; int next; }edge[maxn]; int head[maxn]; int n,m,cnt; int step[maxn]; int sp,ep; void Addedge(int
2016-09-21 20:26:41 250
原创 HDU 4417 Super Mario(离线线段树)
#include #include #include using namespace std; const int maxn=1e6+5; int sum[maxn*4],n; int ans[maxn]; struct Node1 { int h; int num; bool operator < (const Node1 temp) const {
2016-09-13 21:43:39 349
原创 HDU 5876 Sparse Graph (补图找最短路/BFS)
#include #include #include #include #include using namespace std; const int maxn=1e6; int head[maxn],le,n,m; int dis[maxn]; int step[maxn]; mape[maxn]; void bfs(int s) { queueQ; Q.push(s);
2016-09-12 19:35:22 341
原创 HDU 4825 Xor Sum (字典树求异或最大值)
#include #include #include using namespace std; const int maxn=1e7+5; int ch[maxn][2]; int sum[maxn]; int le; void add(long long x) { int p=0; for(int i=32; i>=0; i--) { int a=(x>
2016-09-08 21:44:35 1163
原创 Codeforces 706D Vasiliy's Multiset (字典树求异或最大值)
模板#include #include #include using namespace std; const int maxn=1e7+5; int ch[maxn][2]; int sum[maxn]; int le; void add(int x) { int p=1; for(int i=31;i>=0;i--) { int a=(x&(10;
2016-09-08 14:20:57 602
原创 Codeforces 449B Jzzhu and Cities (最短路/SPFA/priority_queue<int>Q)
#include #include #include #include using namespace std; const int maxn=1e6+5; int n,m,k,num; struct node { int x,y; int next,v; }G[maxn]; int head[maxn]; int dis[maxn]; int in[maxn]; int x[ma
2016-09-02 15:55:16 710
原创 Codeforces 706C Hard problem (DP)
#include #include #include #include #include #include using namespace std; long long a[100005]; string str1[100005],str2[100005]; long long dp[100005][2]; int main() { int t; scanf("%d",&t);
2016-08-30 18:52:10 265
原创 HDU 5867 Water problem(复杂水题)
#include #include #include #include int E[1005]; int EE[1005]; int main() { E[1]=3; E[11]=6; E[2]=3; E[12]=6; E[200]=10; E[3]=5; E[13]=8; E[30]=6; E[300]=1
2016-08-25 13:24:59 424
原创 HDU 1301 Jungle Roads (最小生成树/模板题)
代码: #include #include #include #include using namespace std; const int maxn=1005; int maps[maxn][maxn]; int book[maxn]; int dis[maxn]; int main() { int t; while(~scanf("%d",&t)) {
2016-08-22 16:17:21 270
原创 uva 10004 Bicoloring (二分图染色/求一个二分图)
#include #include #include using namespace std; const int maxn=205; int maps[maxn][maxn]; int vis[maxn],color[maxn]; int n,l,ans; void init() { memset(maps,0,sizeof(maps)); memset(vis,0,sizeof
2016-08-18 09:43:46 322
原创 HDU 1878 欧拉回路(DFS)
算法思想:判断一个图中是否存在欧拉回路(每条边恰好只走一次,并能回到出发点的路径),在以下三种情况中有三种不同的算法:一、无向图每个顶点的度数都是偶数,则存在欧拉回路。 二、有向图(所有边都是单向的)每个节顶点的入度都等于出度,则存在欧拉回路。以上两种情况都很好理解。其原理就是每个顶点都要能进去多少次就能出来多少次。 三、混合图(有的边是单向的,有的边是无向的。常被用于比喻城市里的交通网络,有的路
2016-08-15 10:42:50 618
原创 HDU 5842 Lweb and String (神坑)
#include #include using namespace std; char a[100005]; int b[30]; int main() { int t; scanf("%d",&t); int ui=1; while(t--) { memset(b,0,sizeof(b)); scanf("%s",&a);
2016-08-14 22:15:21 425
原创 POJ 3264 Balanced Lineup(RMQ)
#include #include #include #include using namespace std; const int maxn=5e4+5; int maps[maxn],n,q; int dpmax[maxn][20],dpmin[maxn][20]; void init_rmq() { for(int i=1; i<=n; i++) dpmax[i][0]=dpmi
2016-08-13 16:03:08 186
原创 POJ 2019 Cornfields (二维RMQ)
#include #include #include #include using namespace std; const int maxn=300; int dpmax[maxn][maxn][12]; int dpmin[maxn][maxn][12]; int maps[maxn][maxn]; int n,d,k,q; void init_rmq() { for(int i=1;
2016-08-13 16:01:48 259
原创 HDU 1527 取石子游戏 (威佐夫博弈)
#include #include #include #include using namespace std; int main() { int a,b; while(~scanf("%d%d",&a,&b)) { if(a>b) swap(a,b); int t=b-a; double k=(sqrt(5.0)+1.0)/
2016-08-12 12:23:50 270
原创 HDU 5826 (物理公式推导)
#include #include #include #include using namespace std; const int maxn=1e5+5; double v[maxn]; int main() { int t; scanf("%d",&t); while(t--) { int n;double c; scanf("%d%lf",&n
2016-08-12 09:30:57 371
原创 HDU 5391 (威尔逊定理 )
#include #include #include #include using namespace std; int is_prim(int x) { int m=sqrt(x+0.5); for(int i=2;i<=m;i++) { if(x%i==0) { return 0; } }
2016-08-11 15:57:26 345
空空如也
小白求助!!!opencv 怎样将一张图片上蓝色点的坐标输出出来???
2016-12-07
TA创建的收藏夹 TA关注的收藏夹
TA关注的人