【Codeforces 411A】Password Check】的更多相关文章

[链接] 我是链接,点我呀:) [题意] 题意 [题解] 傻逼模拟题 [代码] import java.io.*; import java.util.*; public class Main { static InputReader in; static PrintWriter out; public static void main(String[] args) throws IOException{ //InputStream ins = new FileInputStream("E:\\r…
[链接] 我是链接,点我呀:) [题意] 给你一个字符串s 让你从中选出来一个字符串t 这个字符串t是s的前缀和后缀 且在除了前缀和后缀之外的中间部位出现过. 且要求t的长度最长. 让你输出这个字符串t [题解] KMP的应用 f[i]就是以i为结尾的后缀能匹配的最长前缀的长度 因此只要知道f[n]的值. 然后在做kmp的时候,看看中间有没有哪个时刻能匹配到长度为f[n]的前缀就好(开个数组标记一下就好); 如果没有就让j = f[f[n]] 直到匹配不到为止. [代码] import java…
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=2000),问满足[数列长度是k && 数列中每一个元素arr[i]在1~n之间 && 数列中元素可以重复]的数列有多少个?结果对10^9+7取余 解题思路:dp[i][j]表示长度是j,最后一位是i的种数 if(kk%i==0) dp[kk][j+1]+=dp[i][j] #inc…
]password保 主要知识: 1.        while循环 2.        do-while循环 3.        if-else 4.        strcmp()函数 [充电一下] strcmp()函数的知识 原型:int strcmp ( const char * str1, const char * str2 ); 返回值: < 0 表示str1与str2不相等,其的值小于str2的值 =0 表示str1与str2相等 >0 表示str与str2不等.且其值大于str…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output After overcoming the stairs Dasha came to classes. She needed to write a password to begin her classes. The password is a string of length n whi…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output After overcoming the stairs Dasha came to classes. She needed to write a password to begin her classes. The password is a string of length n whi…
[题目链接]:http://codeforces.com/problemset/problem/508/D [题意] 给你一个字符的所有连续3个的子串; 让你复原出原串; (包含小写.大写字母以及数字); [题解] 相当于给你n条边; 每条边的两端; 一个点是由s[0]s[1]组成的; 另一端是s[1]s[2]组成的; (用map很容易做hash..) 然后让你求一个欧拉通路; 即经过所有的边仅一次的路径(一笔画); 有向图; 可以先算出每个点的入度和出度; 设入度和出度的差的点数为1的个数为c…
[题目链接]:http://codeforces.com/problemset/problem/767/D [题意] 每个牛奶都有最晚可以喝的时间; 每天喝K瓶牛奶; 你有n瓶牛奶->已知每个牛奶的期限; 然后商店里面有m瓶牛奶:->已知每个牛奶的期限; 然后问你最多能再从商店里买几瓶牛奶; 使得你买的这些牛奶都不会因为过期而被扔掉; 或者你原本的n瓶牛奶都不能做到则输出-1 [题解] 首先肯定喝的顺序是先喝马上就要过期的 ->所以原有的n瓶升序排; 然后买的话,肯定是买晚过期的; 所以…
[题目链接]:http://codeforces.com/contest/807/problem/D [题意] 给出n个人的比赛信息; 5道题 每道题,或是没被解决->用-1表示; 或者给出解题的所用的时间; (每道题的分数与解决率有关,越高,分越低); 然后有个人想利用这个特点,注册很多个账号; 试图改变每道题的解决率,以期让自己的分数大于某个人; 如果这个人没有解决某道题的话; 那些新加入的人也不能解决那道题. 问最少需要注册多少个账号才能让你的分数大于某个人; [题解] 顺序枚举加入了多少…
[题目链接]:http://codeforces.com/contest/379/problem/D [题意] 让你构造出两个长度分别为n和m的字符串s[1]和s[2] 然后按照连接的规则,顺序连接s[n-2]和s[n-1]得到s[n] (n>=3) 即s[n] = s[n-2]+s[n-1] 以此规则得到s[k]; 要求s[k]恰好出现x个"AC"子串; [题解] 暴力题; 枚举s1有ac1个"AC"子串,s2有ac2个"AC"子串; 这…