摘要:
题意:给出给出n个单词,要求判断这些单词能否接龙,规则像成语接龙一样,就是当前单词的尾字母为下一个单词的首字母。思路:看着像是欧拉通路相关的题目,但是重点就在于怎么抽象出来。刚开始想了半天没想明白,老想着一个单词作为一个顶点去了,就是没转过来。看了篇解题报告(http://blog.csdn.net... 阅读全文
posted @ 2015-08-14 20:17
gongpixin
阅读(242)
评论(0)
推荐(0)
摘要:
题意:给出点、边,判断是不是一棵树 思路:问题是如何判断是不是树? 我总结了一下,但不官方,正确性待验证。 1.入度<=1(根节点为0,其他为1) 2.不能有环 3.只有一个根节点 #include<iostream> #include<stdio.h> #include<string.h> usi 阅读全文
posted @ 2015-08-14 19:19
gongpixin
阅读(203)
评论(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
阅读(222)
评论(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
阅读(175)
评论(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
阅读(246)
评论(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
阅读(302)
评论(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
阅读(457)
评论(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
阅读(228)
评论(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
阅读(193)
评论(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
阅读(149)
评论(0)
推荐(0)
摘要:
题意:裸kmp思路:kmp模板#include#include#includeusing namespace std;#define MaxSize 10005int s[1000005],t[10005];int next2[MaxSize];void GetNext(int t[],int le... 阅读全文
posted @ 2015-08-14 11:28
gongpixin
阅读(391)
评论(0)
推荐(0)
摘要:
题意:统计单串中从某个位置以前有多少重复的串思路:kmp模板#include#include#includeusing namespace std;#define MaxSize 1000005char str[MaxSize];int next2[MaxSize];void GetNext(cha... 阅读全文
posted @ 2015-08-14 11:26
gongpixin
阅读(406)
评论(0)
推荐(0)
摘要:
题意:小数大数加法思路:大数模板#include#include#includeusing namespace std;void plu(char *a,char *b){//注意存储方式:整数倒着存,小数正着存,看代码需注意 int i,j,k,lena,lenb,lena1,lena2,l... 阅读全文
posted @ 2015-08-14 11:20
gongpixin
阅读(237)
评论(0)
推荐(0)
摘要:
题意:整数大数加法思路:大数模板#include#include#include#includeusing namespace std;#define MAXN 9999//万进制#define DLEN 4//4位class BigNum{private: int a[500];//可以控制... 阅读全文
posted @ 2015-08-14 11:18
gongpixin
阅读(337)
评论(0)
推荐(0)
摘要:
题意:整数大数加法思路:大数模板#include#include#include#includeusing namespace std;#define MAXN 9999//万进制#define DLEN 4//4位class BigNum{private: int a[500];//可以控制... 阅读全文
posted @ 2015-08-14 11:16
gongpixin
阅读(224)
评论(0)
推荐(0)
摘要:
题意:整数大数乘法思路:大数模板#include#include#include#includeusing namespace std;#define MAXN 9999//万进制#define DLEN 4//4位class BigNum{private: int a[50000];//可以... 阅读全文
posted @ 2015-08-14 11:12
gongpixin
阅读(298)
评论(0)
推荐(0)
摘要:
题意:整数大数加法思路:大数模板#include#include#include#includeusing namespace std;#define MAXN 9999//万进制#define DLEN 4//4位class BigNum{private: int a[500];//可以控制... 阅读全文
posted @ 2015-08-14 11:08
gongpixin
阅读(222)
评论(0)
推荐(0)