Revolving Digits(hdu 4333)】的更多相关文章

题意:就是给你一个数字,然后把最后一个数字放到最前面去,经过几次变换后又回到原数字,问在这些数字中,比原数字小的,相等的,大的分别有多少个.比如341-->134-->413-->341,所以和原数字相比,比原数字小的有一个,相等的有一个,大的有一个. /* 如果比较两个字符串,就比较第一位不一样的,那我们就需要找出所有字符串和已知字符串的前缀公共部分. 在已知字符串后面载copy一份,然后做exkmp就行了. 需要注意的是,相同字符串只能出现一次,所以先求一遍循环节. 有一篇关于exk…
http://acm.hdu.edu.cn/showproblem.php?pid=4333 题意 一个数字,依次将第一位放到最后一位,问小于本身的数的个数及等于本身的个数和大于本身的个数,但是要注意重复的不再计算 分析 当这个串有循环节时才会出现重复串,用KMP的next数组来计算循环节:len-next[len].最后将得到的答案除以循环节个数即可.然后用扩展KMP,求出主串的后缀与模式串的前缀的最长公共前缀,这里的模式串是原串,而主串则是将两个原串连接起来.利用extend数组,当exte…
//1088(参考博客:http://blog.csdn.net/libin56842/article/details/8950688)//1.编写一个浏览器输入输出(hdu acm1088)://思路:对已经输入的字符串进行处理,遇到<br><hr>分别进行处理.遇到多于80个字符(统计该行的长度)或者<br>或者结束,则换行:遇到<hr>,输出80个'-'.#include<stdio.h>#include<string.h>#d…
One day Silence is interested in revolving the digits of a positive integer. In the revolving operation, he can put several last digits to the front of the integer. Of course, he can put all the digits to the front, so he will get the integer itself.…
Revolving Digits   Description One day Silence is interested in revolving the digits of a positive integer. In the revolving operation, he can put several last digits to the front of the integer. Of course, he can put all the digits to the front, so…
Revolving Digits Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 24215    Accepted Submission(s): 5268 Problem Description One day Silence is interested in revolving the digits of a positive int…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5064 题目意思:给出n个数:a1, a2, ..., an,然后需要从中找出一个最长的序列 b1, b2, ...,  bt.需要满足两个条件(1)b1≤b2≤…≤bt   (2)b2−b1≤b3−b2≤⋯≤bt−bt−1.求出最大的 t 为多少. 遗留大半年的题目呀呀呀呀~~~~!!!首先非常感谢乌冬子大半年前的指点迷津,呕心沥血想了大半天举出个反例,以便指出我算法的错误.为了纪念这个伟大的人物(…
http://acm.hdu.edu.cn/showproblem.php?pid=4605 Magic Ball Game Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 309    Accepted Submission(s): 73 Problem Description When the magic ball game tu…
Description You are given a positive integer nn. Let S(x) be sum of digits in base 10 representation of xx, for example, S(123)=1+2+3=6, S(0)=0. Your task is to find two integers a,ba,b, such that 0≤a,b≤n, a+b=n and S(a)+S(b) is the largest possible…
http://acm.hdu.edu.cn/showproblem.php?pid=2686     Problem Description Yifenfei very like play a number game in the n*n Matrix. A positive integer number is put in each area of the Matrix.Every time yifenfei should to do is that choose a detour which…