WA题集
#include <iostream> #include <cstring> #include <cstdio> #include <algorithm> #include <cmath> using namespace std; + ; struct points { double x,y; }; points point[MAX]; double d[MAX][MAX]; double dist(int a, int b) { return sqrt( (point[a].x - point[b].x) * (point[a].x - point[b].x) + (point[a].y - point[b].y) * (point[a].y - point[b].y)); } int main() { int n; while(scanf("%d", &n) != EOF) { ; i <= n; i++) scanf("%lf%lf", &point[i].x, &point[i].y); ; i < n - ; i++) d[n - ][i] = dist(n - , n) + dist(i, n); ; i > ; i--) { ; j < i; j++) { ][j] + dist(i, i + ) - d[i + ][i] - dist(j, i + ) > 0.00001) d[i][j] = d[i + ][j] + dist(i, i + ); else d[i][j] = d[i + ][i] + dist(j, i + ); } } printf(][] + dist(,)); } ; }
UVA1347紫书dp
zoj1163http://blog.csdn.net/cherry_sun/article/details/6245208
#include <iostream> #include <cstring> #include <algorithm> #include <map> #include <cstdio> using namespace std; map<string,int> color; ][],cnt[],sum[]; + ]; int main() { int n,m; while(scanf("%d%d", &n, &m) != EOF) { && m == ) break; ]; ; i <= n; i++) { scanf("%s", temp); color[temp] = i; } int x; memset(cnt, , sizeof(cnt)); memset(sum, , sizeof(sum)); memset(ans, , sizeof(ans)); ; i <= m; i++) { scanf("%d%s",&x, temp); cloth[ color[temp] ][ cnt[ color[temp] ]++ ] = x; } ; i <= n; i++) { ; j < cnt[i]; j++) { sum[i] += cloth[i][j]; } } ; ; i <= n; i++) { ; ; j < cnt[i]; j++) { for(int k = v; k >= cloth[i][j]; k--) { ans[k] = max(ans[k], ans[k - cloth[i][j]] + cloth[i][j]); } } all += sum[i] - ans[v]; } printf("%d\n",all); } ; }
UVA类似于8皇后问题
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; ; int g[MAX][MAX],vis[MAX][MAX*MAX]; int n,m,ans,t; void dfs(int x,int cnt) { ; for(int i = x; i < n; i++) { ; j < m; j++) { if(g[i][j]) { ][j] == && vis[][i + j] == && vis[][i - j + t] == ) { flag = ; break; } } } ) { break; } } ) { ans =min(ans,cnt); return ; } ; i < m; i++) { if(g[x][i]) { ][i] == && vis[][x + i] == && vis[][x - i + t] == ) { vis[][i] = vis[][x + i] = vis[][x - i + t] = ; dfs(x + , cnt + ); vis[][i] = vis[][x + i] = vis[][x - i + t] = ; } } } } int main() { ; while(scanf("%d", &n) != EOF) { ) break; scanf("%d", &m); t = max(n,m); getchar(); memset(vis,,sizeof(vis)); memset(g,,sizeof(g)); char ch; ; i < n; i++) { ; j < m; j++) { scanf("%c",&ch); if(ch == 'X') g[i][j] = ; } getchar(); } ans = ; dfs(,); printf("Case %d: %d\n",num++,ans); } ; }
POJ 3026 Borg Maze
http://poj.org/problem?id=3026
#include <iostream> #include <cstdio> #include <algorithm> #include <queue> #include <cstring> using namespace std; typedef pair<int,int> P; ; ][]; ][],vis[][],dis[][],edge[][]; int t,row,col,num; ][]={{,},{,},{,-},{-,} }; void bfs(int x,int y) { queue<P> q; P point; point.first = x; point.second = y; memset(vis,,sizeof(vis)); memset(dis,,sizeof(dis)); vis[x][y] = ; q.push(point); while(q.size()) { P temp; temp = q.front(); q.pop(); if( node[temp.first][temp.second] ) { // cout<<node[x][y] <<" "<<node[point.first][point.second]<<endl; edge[ node[x][y] ][ node[temp.first][temp.second] ] = dis[temp.first][temp.second]; } ; i < ; i++) { ]; ]; && fy >= && fx < row && fy < col) { && g[fx][fy] != '#') { dis[fx][fy] = dis[temp.first][temp.second] + ; vis[fx][fy] = ; point.first = fx; point.second = fy; q.push(point); } } } } } void prime() { ]; ]; ; i < num; i++) { v[i] = false; } ; i < num; i++) s[i] = edge[][i]; v[] = true; ; ; i < num; i++) { int pos, minn = INF; ; j < num; j++) { if(v[j] == false && s[j] < minn) { minn = s[j]; pos = j; } } sum += minn; v[pos] = true; ; j < num; j++) { if(s[j] > edge[pos][j]) s[j] = edge[pos][j]; } } printf("%d\n",sum); } int main() { scanf("%d", &t); while(t--) { scanf("%d%d", &col,&row); getchar(); num = ; memset(node,,sizeof(node)); memset(edge,,sizeof(edge)); ; i < row; i ++) { ; j < col; j++) { scanf("%c", &g[i][j]); if(g[i][j] == 'A' || g[i][j] == 'S') node[i][j] = num++; } getchar(); } ; i < row; i++) { ; j < col; j++) if(node[i][j]) bfs(i,j); } prime(); } ; }
POJ2253
#include <iostream> #include <cstring> #include <cstdio> #include <algorithm> #include <cmath> using namespace std; + ; << ; struct Node { int x,y; }; Node point[MAX]; int N; double path[MAX][MAX],dist[MAX],ans; int vis[MAX]; void prime() { memset(vis,,sizeof(vis)); ; i <= N; i++) dist[i] = path[][i]; vis[] = ; dist[] = ; ; ; i < N; i++) { double minn = INF; ; j <= N; j++) { && dist[j] < minn) { minn = dist[j]; pos = j; } } vis[pos] = ; dist[pos] = minn; ) return; if(ans < minn) ans = minn; ; j <= N; j++) { ) dist[j] = dist[pos] + path[pos][j]; } } } int main() { ; while(scanf("%d", &N) != EOF && N) { ; i <= N; i++) { scanf("%d%d",&point[i].x,&point[i].y); } ; i <= N; i++) { ; j <= N; j++) { double x = point[i].x - point[j].x; double y = point[i].y - point[j].y; path[i][j] = sqrt(x * x + y * y); } } ans = ; prime(); printf("Scenario #%d\n",++t); if(ans) printf("Frog Distance = %0.3lf\n",ans); else printf(][]); printf("\n"); } ; }
WA题集的更多相关文章
- 数位dp题集
题集见大佬博客 不要62 入门题,检验刚才自己有没有看懂 注意一些细节. 的确挺套路的 #include<bits/stdc++.h> #define REP(i, a, b) for(r ...
- ACM题集以及各种总结大全!
ACM题集以及各种总结大全! 虽然退役了,但是整理一下,供小弟小妹们以后切题方便一些,但由于近来考试太多,顾退役总结延迟一段时间再写!先写一下各种分类和题集,欢迎各位大牛路过指正. 一.ACM入门 关 ...
- 全国各大 oj 分类题集...
各种题集从易到难刷到手软 你准备好了吗? 准备剁手吧
- ACM题集以及各种总结大全(转)
ACM题集以及各种总结大全! 虽然退役了,但是整理一下,供小弟小妹们以后切题方便一些,但由于近来考试太多,顾退役总结延迟一段时间再写!先写一下各种分类和题集,欢迎各位大牛路过指正. 一.ACM入门 关 ...
- 组合数取模&&Lucas定理题集
题集链接: https://cn.vjudge.net/contest/231988 解题之前请先了解组合数取模和Lucas定理 A : FZU-2020 输出组合数C(n, m) mod p (1 ...
- Bug是一种财富-------研发同学的错题集、测试同学的遗漏用例集
此文已由作者王晓明授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 各位看官,可能看到标题的你一定认为这是一篇涉嫌"炒作"的文章,亦或是为了吸引眼球而起的标 ...
- 二级C语言题集
时间:2015-5-13 18:01 在131题之后是按考点分类的题集,有需要的朋友可以看一下 ---------------------------------------------------- ...
- 中南大学2019年ACM寒假集训前期训练题集(基础题)
先写一部分,持续到更新完. A: 寒衣调 Description 男从戎,女守家.一夜,狼烟四起,男战死沙场.从此一道黄泉,两地离别.最后,女终于在等待中老去逝去.逝去的最后是换尽一生等到的相逢和团圆 ...
- 【转】并查集&MST题集
转自:http://blog.csdn.net/shahdza/article/details/7779230 [HDU]1213 How Many Tables 基础并查集★1272 小希的迷宫 基 ...
随机推荐
- 非域客户端的office使用RMS加密服务出现‘介绍“信息权限管理服务”’服务的提示
环境:office2007,需要使用windows RMS服务,客户机处于工作组模式,如图: 出现这个说明客户机没有发现RMS服务,可以通过导入注册表解决,如下: Windows Registry E ...
- @property中的copy.strong.weak总结
1.NSString类型的属性为什么用copy NSString类型的属性可以用strong修饰,但会造成一些问题,请看下面代码 #import "ViewController.h" ...
- React Native 之 组件化开发
前言 学习本系列内容需要具备一定 HTML 开发基础,没有基础的朋友可以先转至 HTML快速入门(一) 学习 本人接触 React Native 时间并不是特别长,所以对其中的内容和性质了解可能会有所 ...
- QQ空间/朋友圈类界面的搭建
类似于QQ空间的布局主要是在说说信息.点赞.回复三大部分的自适应布局上. 当我们需要搭建类似QQ空间.微信朋友圈的界面的时候,可做如下操作: 创建一个对应的model类: 创建一个对应model类的f ...
- nodejs pm2部署配置
pm2是一个进程管理工具,可以用它来管理你的node进程,并查看node进程的状态,当然也支持性能监控,进程守护,负载均衡等功能. 1.pm2安装使用需要全局安装 npm install -g pm ...
- 使用jenkins配置.net mvc网站进行持续集成三
前两篇讲解了Jenkins的配置和VS远程发布,现在还有一个问题,VS项目远程发布的时候,配置的是覆盖所有文件重生成的,而通常类似于配置文件这种东西,在本地开发环境和测试环境是不一样的.所以我们通常需 ...
- java工具类
1.HttpUtilsHttp网络工具类,主要包括httpGet.httpPost以及http参数相关方法,以httpGet为例:static HttpResponse httpGet(HttpReq ...
- [LeetCode] Paint House II 粉刷房子之二
There are a row of n houses, each house can be painted with one of the k colors. The cost of paintin ...
- [LeetCode] Repeated DNA Sequences 求重复的DNA序列
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...
- 使用Bandwagon的VPS第一件事《FQ》
说点闲话:昨天的长靴子到了,哎呀,今天那个高兴,踩着我的8厘米的过膝靴就出门上专业外语去了,扎了个麻花辫子,那个心情好哟,搞得我都不想继续学习linux平台上的C语言了,好想逛街----秀秀我的鞋子, ...