摘要: Problem Description网上流传一句话:"常在网上飘啊,哪能不挨刀啊~"。其实要想能安安心心地上网其实也不难,学点安全知识就可以。首先,我们就要设置一个安全的密码。那什么样的密码才叫安全的呢?一般来说一个比较安全的密码至少应该满足下面两个条件:(1).密码长度大于等于8,且不要超过16。(2).密码中的字符应该来自下面“字符类别”中四组中的至少三组。这四个字符类别分别为:1.大写字母:A,B,C...Z;2.小写字母:a,b,c...z;3.数字:0,1,2...9;4.特殊符号:~,!,@,#,$,%,^;给你一个密码,你的任务就是判断它是不是一个安全的密码 阅读全文
posted @ 2011-11-16 22:10 狸の舞 阅读(239) 评论(0) 推荐(0) 编辑
摘要: Problem Description有一楼梯共M级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第M级,共有多少种走法?Input输入数据首先包含一个整数N,表示测试实例的个数,然后是N行数据,每行包含一个整数M(1<=M<=40),表示楼梯的级数。Output对于每个测试实例,请输出不同走法的数量Sample Input2 2 3Sample Output1 2#include<stdio.h>#include<stdlib.h>int main(){ int n, f[1000], a; int i, j, t; scanf( "%d 阅读全文
posted @ 2011-11-16 21:10 狸の舞 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Problem Description你活的不容易,我活的不容易,他活的也不容易。不过,如果你看了下面的故事,就会知道,有位老汉比你还不容易。重庆市郊黄泥板村的徐老汉(大号徐东海,简称XDH)这两年辛辛苦苦养了不少羊,到了今年夏天,由于众所周知的高温干旱,实在没办法解决牲畜的饮水问题,就决定把这些羊都赶到集市去卖。从黄泥板村到交易地点要经过N个收费站,按说这收费站和徐老汉没什么关系,但是事实却令徐老汉欲哭无泪:(镜头回放)近景:老汉,一群羊远景:公路,收费站......收费员(彬彬有礼+职业微笑):“老同志,请交过路费!”徐老汉(愕然,反应迟钝状):“锅,锅,锅,锅-炉-费?我家不烧锅炉呀?” 阅读全文
posted @ 2011-11-16 21:09 狸の舞 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 给你n个整数,求他们中所有奇数的乘积。#include <stdio.h>int main(){int n,t,result;while (scanf("%d", &n)!=0){result = 1;for (int i = 0; i < n; ++i){scanf ("%d", &t);if (((t % 2) != 0) && (t != 0))result *= t;}printf("%d\n", result);}return 0;}给定一段连续的整数,求出他们中所有偶数的平 阅读全文
posted @ 2011-11-16 00:53 狸の舞 阅读(2749) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <math.h>int main(){int i, m, n,t;int a,b,c;bool flag;while( scanf( "%d %d",&n, &m ) != EOF ){if( n > m ){t = n;n = m;m = t;}flag = false;for( i = n ; i <= m ;i++ ){a = i/100;b = (i/10);c = i;if( i == a*a*a + b*b*b + c*c*c ){if( flag == f 阅读全文
posted @ 2011-11-16 00:52 狸の舞 阅读(174) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>void print( int m,int n ){for( int i=1;i<=n-m;i++ )printf( " " );for( int i=1;i<=m*2-1;i++ )printf( "*" );puts("");if( m==n )return ;else{print( m+1,n );for( int i=1;i<=n-m;i++ )printf( " " );for( int i=1;i<=m*2-1;i++ )printf 阅读全文
posted @ 2011-11-16 00:52 狸の舞 阅读(460) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>int main(){char str[5];int n;scanf( "%d",&n );for( ; n > 0 ; n-- ){scanf( "%s",str);if( strlen(str) > 3 )printf( "3\n" );elseif((( str[0] == 'o' ) && ( str[1] == 'n' 阅读全文
posted @ 2011-11-16 00:51 狸の舞 阅读(112) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(){int ah,am,as,bh,bm,bs,i,k,n,zh,zm,zs;while( scanf("%d",&n) != EOF ){for ( k=0; k<n; k++ ){ah=0, am=0, as=0, bm=0, bh=0, bs=0, zm=0, zh=0, zs=0;scanf("%d %d %d %d %d %d",&ah,&am,&as,&bh,&bm,&bs);zs=as+bs;zm=am+bm;zh= 阅读全文
posted @ 2011-11-16 00:50 狸の舞 阅读(198) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<math.h>#include<string.h>int main(){char str[1000000];int num[30]={0}, t, i, j, k, a;while( gets( str ) ){t = strlen( str );int num[30]={0};for( i = 0; i < t; i++ ){if( str[i] >= 'a' && str[i] <= 'z' )num[ str[i] - 'a&# 阅读全文
posted @ 2011-11-16 00:50 狸の舞 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionThese days, I am thinking about a question, how can I get a problem as easy as A+B? It is fairly difficulty to do such a thing. Of course, I got it after many waking nights.Give you some integers, your task is to sort these number ascending (升序).You should know how easy the proble 阅读全文
posted @ 2011-11-16 00:47 狸の舞 阅读(210) 评论(0) 推荐(0) 编辑
摘要: Problem Descriptionlcy gives a hard puzzle to feng5166,lwg,JGShining and Ignatius: gave a and b,how to know the a^b.everybody objects to this BT problem,so lcy makes the problem easier than begin.this puzzle describes that: gave a and b,how to know the a^b's the last digit number.But everybody i 阅读全文
posted @ 2011-11-16 00:46 狸の舞 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 还记得中学时候学过的杨辉三角吗?具体的定义这里不再描述,你可以参考以下的图形:11 11 2 11 3 3 11 4 6 4 11 5 10 10 5 1Input输入数据包含多个测试实例,每个测试实例的输入只包含一个正整数n(1<=n<=30),表示将要输出的杨辉三角的层数。Output对应于每一个输入,请输出相应层数的杨辉三角,每一层的整数之间用一个空格隔开,每一个杨辉三角后面加一个空行。Sample Input2 3Sample Output1 1 1 1 1 1 1 2 1#include<stdio.h>int main(){int n, num[32][32 阅读全文
posted @ 2011-11-16 00:46 狸の舞 阅读(594) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionAn inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, it slips down d inches. The process of climbing and resting then repeats. How long before the worm clim 阅读全文
posted @ 2011-11-16 00:46 狸の舞 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Problem Description参加过上个月月赛的同学一定还记得其中的一个最简单的题目,就是{A}+{B},那个题目求的是两个集合的并集,今天我们这个A-B求的是两个集合的差,就是做集合的减法运算。(当然,大家都知道集合的定义,就是同一个集合中不会有两个相同的元素,这里还是提醒大家一下)呵呵,很简单吧?Input每组输入数据占1行,每行数据的开始是2个整数n(0<n<=100)和m(0<m<=100),分别表示集合A和集合B的元素个数,然后紧跟着n+m个元素,前面n个元素属于集合A,其余的属于集合B. 每个元素为不超出int范围的整数,元素之间有一个空格隔开.如果 阅读全文
posted @ 2011-11-16 00:45 狸の舞 阅读(467) 评论(0) 推荐(0) 编辑
摘要: DescriptionPetya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes and ones. A zero corresponds to players of one team; a one corresp 阅读全文
posted @ 2011-11-16 00:44 狸の舞 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Description这是一个很简单的纸牌游戏——比大小。每张纸牌都有一个花色:S、H、D和C,以及有一个牌面(6\7\8\9\T\J\Q\K\A)。在游戏最开始的时候,会选择一种花色为王牌花色。游戏是这样玩的:玩家1和玩家2各出一张牌,看谁大。如果两张牌都不是王牌花色或则都是王牌花色,则牌面大的牌大,如果牌面一样大则一样大。若其中一张牌是王牌而另一张不是,则无论牌面如何都是王牌花色大。Input第一行一个数字n,代表数据组数(n <= 10)对于每组数据,首先输入一个字符(S\H\D\C),表示王牌花色。接下去一行有两张牌面,表示为牌面花色,如8D、9S等。Output对于每组数据,输 阅读全文
posted @ 2011-11-16 00:44 狸の舞 阅读(498) 评论(0) 推荐(0) 编辑
摘要: Problem Description有一个长度为n(n<=100)的数列,该数列定义为从2开始的递增有序偶数,现在要求你按照顺序每m个数求出一个平均值,如果最后不足m个,则以实际数量求平均值。编程输出该平均值序列。Input输入数据有多组,每组占一行,包含两个正整数n和m,n和m的含义如上所述。Output对于每组输入数据,输出一个平均值序列,每组输出占一行。Sample Input3 2 4 2Sample Output3 6 3 7#include<stdio.h>int main(){int n, m, sum, ave, sum1, ave1;int i, j, a 阅读全文
posted @ 2011-11-16 00:43 狸の舞 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Description万圣节有一个Party,XadillaX显然也要去凑热闹了。因为去凑热闹的人数非常庞大,几十W的数量级吧,自然要进场就需要有门票了。很幸运的,XadillaX竟然拿到了一张真·门票!这真·门票的排列规则有些奇怪:1、门票号是由0~6组成的六位数(0~6这几个数字可重用)2、每一个门票号的每一位不能有三个连续的数字(如123335是不行的)3、每一个门票号相邻的两位相差必须在四以下(≤4)(如016245是不行的)Input第一行一个n,代表数据组数接下去n行,每行两个数字x,y(x <= y)Output对于每一组数据,输出x到y之间的门票编号( 阅读全文
posted @ 2011-11-16 00:43 狸の舞 阅读(204) 评论(0) 推荐(0) 编辑
摘要: Problem Description输入n(n<100)个数,找出其中最小的数,将它与最前面的数交换后输出这些数。Input输入数据有多组,每组占一行,每行的开始是一个整数n,表示这个测试实例的数值的个数,跟着就是n个整数。n=0表示输入的结束,不做处理。Output对于每组输入数据,输出交换后的数列,每组输出占一行。Sample Input4 2 1 3 4 5 5 4 3 2 1 0Sample Output1 2 3 4 1 4 3 2 5#include<stdio.h>int main(){int n, num[1000];int i, j, t, min, fl 阅读全文
posted @ 2011-11-16 00:42 狸の舞 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Problem Description有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛?Input输入数据由多个测试实例组成,每个测试实例占一行,包括一个整数n(0<n<55),n的含义如题目中描述。n=0表示输入数据的结束,不做处理。Output对于每个测试实例,输出在第n年的时候母牛的数量。每个输出占一行。Sample Input2 4 5 0Sample Output2 4 6#include<stdio.h>int main(){int n, i;int can[1000], no[ 阅读全文
posted @ 2011-11-16 00:42 狸の舞 阅读(183) 评论(0) 推荐(0) 编辑