Easier Done Than Said?                                                                     Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Problem Description Password security is a tricky thing. Users prefer simpl…
Problem Description Password security is a tricky thing. Users prefer simple passwords that are easy to remember (like buddy), but such passwords are often insecure. Some sites use random computer-generated passwords (like xvtpzyo), but users have a…
Easier Done Than Said? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 16543    Accepted Submission(s): 7846 Problem Description Password security is a tricky thing. Users prefer simple password…
Easier Done Than Said? Problem Description Password security is a tricky thing. Users prefer simple passwords that are easy to remember (like buddy), but such passwords are often insecure. Some sites use random computer-generated passwords (like xvtp…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1039 Problem Description Password security is a tricky thing. Users prefer simple passwords that are easy to remember (like buddy), but such passwords are often insecure. Some sites use random computer-g…
水水的 #include <iostream> #include <cstring> using namespace std; ]; bool flag; int vol,v2,con; int main() { while(cin>>s) { if(!strcmp(s,"end")) break; flag=; v2=vol=con=; ;s[i]!='\0';i++) { ]&&(s[i]!='e'&&s[i]!=…
N! Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!   Input One N in one line, process to the end of file.   Output For each N, output N! in one line.   Sample Input 1 2 3   Sample Output 1 2 6 高精度乘法.数组存,每一位存5位数,不然会…
规则: 1.必须至少包含一个元音字母.a e i o u 2.不能包含三个连续元音或者连续辅音字母. 3.不能包含两个连续字母,除了'ee'和'oo'. PS:字母个数(1<= N <=20). #define _CRT_SECURE_NO_DEPRECATE #include <stdio.h> #include <stdlib.h> #include <string.h> int is_vowel(char strIn) { if(strIn == 'a…
题意是检查一个字符串是否满足三个条件: 一.至少有一个元音字母.二.不能出现三个连续的元音或三个连续的辅音.三.除了 ee 和 oo 外不能出现两个连续相同字母. 若三个条件都能满足,该字符串满足条件,有一个条件不满足则该字符串不满足条件. 但是这道题的数据......一定有元音字母,长度一定不少于 3.省去很多麻烦...... 代码如下: #include <bits/stdc++.h> using namespace std; int main() { int len; bool f; s…
题目链接:hdu 5469 Antonidas 题意: 给你一颗树,每个节点有一个字符,现在给你一个字符串S,问你是否能在树上找到两个节点u,v,使得u到v的最短路径构成的字符串恰好为S. 题解: 这题可以用树的分治+字符串hash,不过搜索+剪枝写的好一样可以过,而且跑的时间和正解差不多. 搜索的做法就是先随便找一个点当作根,然后预处理一下最大的深度,然后枚举起点,开始向各个方向遍历,如果这个点的最大深度小于未匹配的字符串长度,那么久向父亲方面搜. #include<bits/stdc++.h…
http://acm.hdu.edu.cn/showproblem.php?pid=2087 Problem Description 一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案.对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢?   Input 输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样.花纹条和小饰条不会超过1000个字符长.如果遇见#字符,则不…
http://acm.hdu.edu.cn/showproblem.php?pid=5442 题目大意: 给定一个字符串,可理解成环,然后选定一位置,逆时针或顺时针走一遍,希望得到字典序最大,如果同样大,希望找到起始位置最小的,如果还相同,就默认顺时针 后缀自动机上s记录达到的最长的位置,如果不更新,那么必然一次跑完得到的是最小位置,那么为了得到最大,之前更新每一个节点中的s,只有儿子位置上的能更新父亲 所以先将后缀自动机拓扑排序,然后从后往前,不断将父亲的s更新成更大的s #include <…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1230 Problem Description 读入两个不超过25位的火星正整数A和B,计算A+B.需要注意的是:在火星上,整数不是单一进制的,第n位的进制就是第n个素数.例如:地球上的10进制数2,在火星上记为“1,0”,因为火星个位数是2进制的:地球上的10进制数38,在火星上记为“1,1,1,0”,因为火星个位数是2进制的,十位数是3进制的,百位数是5进制的,千位数是7进制的…… Input 测…
题目链接 Problem Description 哈利波特在魔法学校的必修课之一就是学习魔咒.据说魔法世界有100000种不同的魔咒,哈利很难全部记住,但是为了对抗强敌,他必须在危急时刻能够调用任何一个需要的魔咒,所以他需要你的帮助. 给你一部魔咒词典.当哈利听到一个魔咒时,你的程序必须告诉他那个魔咒的功能:当哈利需要某个功能但不知道该用什么魔咒时,你的程序要替他找到相应的魔咒.如果他要的魔咒不在词典中,就输出"what?" Input 首先列出词典中不超过100000条不同的魔咒词条…
题目 参考了博客http://blog.csdn.net/u013368721/article/details/37575165 //用visit[26][26][26][26]来判断新家新区的子母河前三个组合而成的4个字符的串是否和之前的重复. //再加上最初三个字符,所以,总共有26*26*26*26+3的长度. /* //以下复制自博客http://blog.csdn.net/u013368721/article/details/37575165 题目大意:给你一个整数n,让你输出一个字符…
H Hyper Prefix Sets Prefix goodness of a set string is length of longest common prefix*number of strings in the set. For example the prefix goodness of the set {000,001,0011} is 6.You are given a set of binary strings. Find the maximum prefix goodnes…
传送门 题意: 此题意很好理解,便不在此赘述: 题解: 解题思路:KMP求字符串最小循环节+拓展KMP ①首先,根据KMP求字符串最小循环节的算法求出字符串s的最小循环节的长度,记为 k: ②根据拓展KMP求出字符串s的nex[]数组,那么对于由第 i 位打头构成的新数b,如何判断其与原数a的大小关系呢? 1)如果 i%k == 0,那么b == a: 2)如果 i%k ≠ 0 ,令L=nex[i],那么只需判断s[ i+L ]与s[ L ]的大小关系即可,需要注意的是,如果i+L = len呢…
Phone List Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 25724    Accepted Submission(s): 8593 Problem Description Given a list of phone numbers, determine if it is consistent in the sense th…
Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1780    Accepted Submission(s): 635 Problem Description After Gardon had got Angel's letter, he found it was encoded...Oh my god, why did she enco…
题意:略. 析:按照题目说的,把字符串分割,然后把字符串转成十进制,存起来,可以用数组,我用的向量, 排序一下就OK了.注意的是,要考虑多个5相邻的时候,刚开始没考虑WA了一次. 代码如下: #include <iostream> #include <cstdio> #include <algorithm> #include <queue> #include <vector> #include <cstring> #include &…
魔咒词典 Time Limit: 8000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9381    Accepted Submission(s): 2405 Problem Description 哈利波特在魔法学校的必修课之一就是学习魔咒.据说魔法世界有100000种不同的魔咒,哈利很难全部记住,但是为了对抗强敌,他必须在危急时刻能够调用任何一个需要的魔咒,所以…
  奇偶位互换 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7867    Accepted Submission(s): 5916 Problem Description 给定一个长度为偶数位的0,1字符串,请编程实现串的奇偶位互换.   Input 输入包含多组测试数据:输入的第一行是一个整数C,表示有C测试数据:接下来是C组测试…
题意:给两个字符串s和t,如果能插入一些字符使得s=t,则输出yes,否则输出no.插入规则:在s中选定一个字符c,可以在其后面插入一个字符k,只要k!=c即可. 思路:特殊的情况就是s和t的最长相同字符的前缀不等长,则肯定插不进去,如s="aab",而t="aaab".还有就是,如果第一个字符就不相同了,输出NO,因为不能在最前面插入(看定义)! 只要将这个情况排除掉,其他的就好做了,从后面开始,匹配就往前扫,不匹配就在s中插入对应字符,如果s长度超过了t就输出N…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2206 Problem Description 在网络课程上,我学到了非常多有关IP的知识. IP全称叫网际协议,有时我们又用IP来指代我们的IP网络地址,如今IPV4下用一个32位无符号整数来表示,一般用点分方式来显示.点将IP地址分成4个部分.每一个部分为8位.表示成一个无符号整数(因此不须要用正号出现),如192.168.100.16,是我们非常熟悉的IP地址.一个IP地址串中没有空格出现(由于…
hdu2072:题意:输出给定字符串中的单词数(一个句子中可能有两个相同的单词),这里的思想是把每个单词取出来,放入set(这个集合容器中不允许有相同的元素)中,最后输出该集合的大小即可. 现在的问题就是怎么分割字符串,这里介绍一个C++STL里面的工具--stringstream,其被称之为字符串流, <这里扩展一点>: istringstream类用于执行C++风格的串流的输入操作. ostringstream类用于执行C风格的串流的输出操作. strstream类同时可以支持C风格的串流…
传送门 Description Byteasar is addicted to the English letter 'q'. Now he comes across a string S consisting of lowercase English letters. He wants to find all the continous substrings of S, which only contain the letter 'q'. But this string is really r…
(string process, fgets, scanf, neat utilization of switch clause) simple problem, simple code. #include <cstdio> #include <algorithm> #define MAXLEN 22 char password[MAXLEN]; int main() { //freopen("input.txt","r",stdin); i…
题目 //1,1,2,3,5,8,13,21,34,55…… //斐波纳契数列 #include<math.h> #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int main() { ]; int len,i,a,b,c; while(gets(str)) { len = strlen(str); a=; b=c=; ;i<len;i++)…
题意:设有两个串A和B,现将B反转,再用插入的形式合成一个串.如:A:abc   B:efg:反转B先,变gfe:作插入,agbfce.现在给出一个串,要求还原出A和B. 思路:扫一遍O(n),串A在扫的时候直接输出,串2在扫的时候反向存储,再输出. #include <iostream> #include <cmath> #include <cstdio> #include <cstring> using namespace std; ; char str…
简单题,但要考虑一些细节: 前导0不要,后导0不要,小数长度不一样时,有进位时,逆置处理输出 然后处理起来就比较麻烦了. 题目链接 我的代码纯模拟,把小数点前后分开来处理,写的很繁杂,纯当纪念——可怜我的眼睛. #include<string.h> #include<stdio.h> int i,la,lb,la1,lb1,la2,lb2,lc1,lc2,yi,temp; ],b[],a1[],a2[],b1[],b2[],c1[],c2[]; void nizhi1(){ ; c…