摘要: ~题目链接~http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=2087&cid=1182输入1160 10结果10.00就是用 对列模拟#include#include#include#includeusing namespace std;int main(){ int T; scanf("%d",&T); while(T--){ //模拟窗口 queueQ; queueP; int n,x,y,q=0,p=0,time=0;//q、p分别记录队列Q、P中最后一位的离开时... 阅读全文
posted @ 2013-08-02 16:49 Locke_Q 阅读(415) 评论(0) 推荐(0) 编辑
摘要: ~题目连接~http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=2484&cid=1182输入a*b+(c-d/e)*f#结果+*ab*-c/defa*b+c-d/e*fab*cde/-f*+小白书上有,表达式树#include#include#include#define maxn 1000+10int lc[maxn],rc[maxn],nc=0;//每个结点的左右儿子编号和字符char jc[maxn];//结点数//表达式树int build(char *s,int x,int y){ int i,c1 =-1,c2=-1,p=0 阅读全文
posted @ 2013-08-02 16:48 Locke_Q 阅读(250) 评论(0) 推荐(0) 编辑
摘要: ~题目链接~http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=1500&cid=1183std::string字符串大小写转换~http://www.haogongju.net/art/2158882ai枫 的博客 http://www.cnblogs.com/luyingfeng/p/3161649.html输入5 3InkfishHenryCarpMaxJerichoCarpMaxCarp0结果3(1).multimap多重映照容器 +std::transform函数#include#include#include#include# 阅读全文
posted @ 2013-08-02 16:47 Locke_Q 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 题目输入32 20 10 02 20 11 02 30 0 00 0 0结果104#include#include#include#define maxn 10int map[maxn][maxn],vis[maxn][maxn],n,m,k;void BFS(int u,int v){ int x,y; int a[]= {0,0,-1,1},b[]= {-1,1,0,0}; for(int i=0; i0 && y0) { if(!map[x][y] && !vis[x][y]) { ... 阅读全文
posted @ 2013-08-02 16:46 Locke_Q 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 题目连接http://poj.org/problem?id=3278输入5 17结果4农民约翰到达逃犯牛最快的方式是沿着以下路径:5-10-9-18-17,需要4分钟。(1).向后-1 (2).向前+1 (3).向前2*x广度优先搜索练习,BFS#include#include#include#include#define maxn 100010using namespace std;int s[maxn],v[maxn];queueQ;int BFS(int n,int k){ int start,step; Q.push(n); v[n]=1; s[n]=0; ... 阅读全文
posted @ 2013-08-02 16:45 Locke_Q 阅读(196) 评论(0) 推荐(0) 编辑