摘要: 对每个数进行标记,然后判断是否出现奇数次。Description给出N个数(保证N为偶数),其中有且只有两个不同的数字出现了奇数次。请你找出他们来。Input对于每组测试数据:第一行,给出数字N,表示下一行输入N个数字,其中N为偶数(2<=N<=100000)第二行,有N个数字(每个数字保证可以使用INT表示)处理到文件结束Output对于每组测试数据:第一行,输出找到的两个数字,由小到大。Sample Input41 2 3 3Sample Output1 2 1 #include<stdio.h> 2 #include<map> 3 #define MA 阅读全文
posted @ 2012-09-29 08:51 尔滨之夏 阅读(650) 评论(0) 推荐(0) 编辑
摘要: Description入侵检测(Intrusion Detection)是对入侵行为的检测。它通过收集和分析网络行为、安全日志、审计数据、其它网络上可以获得的信息以及计算机系统中若干关键点的信息,检查网络或系统中是否存在违反安全策略的行为和被攻击的迹象。入侵检测作为一种积极主动地安全防护技术,提供了对内部攻击、外部攻击和误操作的实时保护,在网络系统受到危害之前拦截和响应入侵。因此被认为是防火墙之后的第二道安全闸门,在不影响网络性能的情况下能对网络进行监测。入侵检测通过执行以下任务来实现:监视、分析用户及系统活动;系统构造和弱点的审计;识别反映已知进攻的活动模式并向相关人士报警;异常行为模式的统 阅读全文
posted @ 2012-09-28 18:36 尔滨之夏 阅读(395) 评论(0) 推荐(0) 编辑
摘要: (a+b+c+···+)%n=(a%n+b%n+···)%n.Total Submit: 130(43 users)Total Accepted: 47(38 users)Special Judge:NoDescription菲波那契数大家可能都已经很熟悉了:f(1)=0 f(2)=1 f(n)=f(n-1)+f(n-2) n>2 因此,当需要其除以某个数的余数时,不妨加一些处理就可以得到。Input输入数据为一些整数对P、K,P(1<P<5000)表示菲波那契数的序号,K(1<=K<15)表示2的幂次方 阅读全文
posted @ 2012-09-27 07:40 尔滨之夏 阅读(724) 评论(0) 推荐(0) 编辑
摘要: 这个题应该没什么难度。如果有也应该是那个判断子串的check_word()函数。int check_word(char s2[55],char s[200]){ int i,j,m=-1; int t=0; int n1=strlen(s2); int n2=strlen(s); for(i=0;i<n1;i++) { for(j=m+1;j<n2;j++) if(s2[i]==s[j]) {m=j;t++;break;} } if(t==n1) return 1; return 0;}好好体会,再多练习练习吧。 1 #include<stdio.h> 2 #inclu 阅读全文
posted @ 2012-09-25 22:43 尔滨之夏 阅读(383) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<map>//利用map函数。 3 #include<string> 4 #include<stdlib.h>//快排头文件。 5 #define MAX 10100 6 using namespace std; 7 int cmp(const void*p1,const void*p2) 8 { 9 return *(int*)p1>*(int*)p2;10 }11 int main()12 {13 map<char,int>v;//存相同字符的个数14 map< 阅读全文
posted @ 2012-09-24 20:41 尔滨之夏 阅读(468) 评论(0) 推荐(0) 编辑
摘要: 要求:给出x1,y1,x2,y2,x3,y3,x4,y4;有三种情况,(1)相交(2)平行(3)共线。有交点了求出DescriptionProfessor Leyni likes to help LOLIs with their math.This time, Leyni meets several LOLIs in the classroom and gets several problems about "Intersecting Lines".The LOLIs want to know how and where two lines intersect.Leyni 阅读全文
posted @ 2012-09-23 20:01 尔滨之夏 阅读(661) 评论(0) 推荐(0) 编辑
摘要: 字符串输入一般是首先建立一个数组,然后有几种选择。(1)用scanf,但scanf遇到空格就停了,不能读出全部的字符,这是一个缺陷。(2)用gets();但需要用getchar()读掉'\n',而且由于gets()可以不停的往里塞东西,所以已被废除。但一般的还可以用,建议最好不用。对以后的学习不太好。(3fgets();这才是我们要说的。但我就不说了,自己看下面的代码吧。自己好好体会。1 #include<stdio.h>//这里给出最简单的。2 int main()3 {4 char a[111];5 fgets(a,111,stdin);6 printf(&qu 阅读全文
posted @ 2012-09-21 07:28 尔滨之夏 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #define MAX 100000000 3 int a[MAX]; 4 int main() 5 { 6 int t,n; 7 int num=3; 8 a[0]=1;a[1]=2;a[2]=4; 9 while(1)10 {11 a[num]=(a[num-1]+a[num-2]+1)%10007;12 if(a[num]==a[2]&&a[num-1]==a[1]&&a[num-2]==a[0])13 break;14 num++... 阅读全文
posted @ 2012-09-20 21:48 尔滨之夏 阅读(389) 评论(0) 推荐(0) 编辑
摘要: 在n*n方阵里填入1,2···,n*n,要求天成蛇形,如n=4时。10 11 12 19 16 13 28 15 14 37 6 5 1 #include<stdio.h> 2 #include<string.h> 3 #define MAX 10 4 int a[MAX][MAX];//注意定义在main()外的好处; 5 int main() 6 { 7 int n,tot; 8 int x,y,i,j; 9 scanf("%d",&n);10 memset(a,0,sizeof(a));11 a[x=0][ 阅读全文
posted @ 2012-09-19 17:03 尔滨之夏 阅读(1878) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 #include<string.h> 3 #define MAX 110 4 int main() 5 { 6 char stack[MAX]; 7 int top,n,i,flag; 8 char a[MAX]; 9 scanf("%d",&n);10 while(n--)11 {12 top=-1;13 flag=0;14 scanf("%s",a);15 for(i=0;i<strlen(a);i++)16 {1... 阅读全文
posted @ 2012-09-18 20:18 尔滨之夏 阅读(248) 评论(0) 推荐(0) 编辑