上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 50 下一页
摘要: 题意:给出给出n个单词,要求判断这些单词能否接龙,规则像成语接龙一样,就是当前单词的尾字母为下一个单词的首字母。思路:看着像是欧拉通路相关的题目,但是重点就在于怎么抽象出来。刚开始想了半天没想明白,老想着一个单词作为一个顶点去了,就是没转过来。看了篇解题报告(http://blog.csdn.net... 阅读全文
posted @ 2015-08-14 20:17 gongpixin 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 题意:给出点、边,判断是不是一棵树 思路:问题是如何判断是不是树? 我总结了一下,但不官方,正确性待验证。 1.入度<=1(根节点为0,其他为1) 2.不能有环 3.只有一个根节点 #include<iostream> #include<stdio.h> #include<string.h> usi 阅读全文
posted @ 2015-08-14 19:19 gongpixin 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 题意:排序后按题目要求输出思路:排序#include#include#includeusing namespace std;int main(){ int a[10000],n,i,j; while(~scanf("%d",&n)){ for(i=0;i<n;++i) ... 阅读全文
posted @ 2015-08-14 11:54 gongpixin 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 题意:找规律思路:找规律#include#includeusing namespace std;int main(){ int n,x,y; scanf("%d",&n); while(n--){ scanf("%d%d",&x,&y); if(x==y... 阅读全文
posted @ 2015-08-14 11:52 gongpixin 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题意:排序思路:排序#include#include#includeusing namespace std;int a[4500005];bool cmp(int a,int b){ return a>b;//降序}int main(){ int b[3005]; int n,m,... 阅读全文
posted @ 2015-08-14 11:50 gongpixin 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 题意:按成绩排序思路:排序#include#include#include#includeusing namespace std;struct node{ char name[25]; int grade;}a[1005];bool cmp(node a,node b){ if(a... 阅读全文
posted @ 2015-08-14 11:48 gongpixin 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 题意:按钟表的时针、分针的夹角对5个时间进行升序排序,输出第3个时间思路:排序注意:若夹角相同,则按时间进行升序排序#include#include#includeusing namespace std;struct node{ int ti[2]; double ang;}a[5];i... 阅读全文
posted @ 2015-08-14 11:47 gongpixin 阅读(444) 评论(0) 推荐(0) 编辑
摘要: 题意:处理后的排序思路:排序#include#include#include#includeusing namespace std;int a[1000];int main(){ char b[1024]; int i,j,len; while(~scanf("%s",b)){ ... 阅读全文
posted @ 2015-08-14 11:43 gongpixin 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 题意:裸排序思路:排序#include#include#includeusing namespace std;int a[1000];int main(){ int t,n,i; scanf("%d",&t); while(t--){ scanf("%d",&n); ... 阅读全文
posted @ 2015-08-14 11:42 gongpixin 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 题意:求出现次数>=(N+1)/2的数思路:排序后,输出第(N+1)/2个数#include#include#includeusing namespace std;int a[999999];int main(){ int n,i; while(~scanf("%d",&n)){ ... 阅读全文
posted @ 2015-08-14 11:40 gongpixin 阅读(143) 评论(0) 推荐(0) 编辑
上一页 1 ··· 31 32 33 34 35 36 37 38 39 ··· 50 下一页