博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
hdu 4333 Revolving Digits
阅读量:6602 次
发布时间:2019-06-24

本文共 2335 字,大约阅读时间需要 7 分钟。

Revolving Digits

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Problem 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 he will get the integer itself. For example, he can change 123 into 312, 231 and 123. Now he wanted to know how many different integers he can get that is less than the original integer, how many different integers he can get that is equal to the original integer and how many different integers he can get that is greater than the original integer. We will ensure that the original integer is positive and it has no leading zeros, but if we get an integer with some leading zeros by revolving the digits, we will regard the new integer as it has no leading zeros. For example, if the original integer is 104, we can get 410, 41 and 104.
 
Input
The first line of the input contains an integer T (1<=T<=50) which means the number of test cases.
For each test cases, there is only one line that is the original integer N. we will ensure that N is an positive integer without leading zeros and N is less than 10^100000.
 
Output
For each test case, please output a line which is "Case X: L E G", X means the number of the test case. And L means the number of integers is less than N that we can get by revolving digits. E means the number of integers is equal to N. G means the number of integers is greater than N.
 
Sample Input
1
341
 
Sample Output
Case 1: 1 1 1

 

Source

 

Recommend
zhoujiaqi2010   |   We have carefully selected several similar problems for you:          
 
题意:输出字符串的同构字符串中,比给出字符串小、等于、大于的个数
相同字符串只能算一次
 
先用kmp求循环节,计算相同字符串
再两个串接起来套扩展kmp模板
 
#include
#include
#include
#define N 200100using namespace std;int nxt[N],cas,len;char T[N];int f[N];void kmp(){ int j; for(int i=1;i
=p) { int j=(p-k+1>0) ? p-k+1 : 0; while(k+j
=len) num2++; else if(T[nxt[i]]>T[i+nxt[i]]) num1++; else num3++; } printf("Case %d: %d %d %d\n",++cas,num1/tt,num2/tt,num3/tt); }}

 

 

转载于:https://www.cnblogs.com/TheRoadToTheGold/p/7043820.html

你可能感兴趣的文章
express 4.0以上的版本 express找不到的问题
查看>>
commons-lang中常用方法
查看>>
spring 定时任务
查看>>
thinkphp 路由规则终极详解(附伪静态)
查看>>
网络安全-加密算法
查看>>
This tag and its children can be replaced by ~~~
查看>>
XCode快捷键
查看>>
struts2 修改action的后缀
查看>>
php保存canvas生成的图片
查看>>
HTML5 定位
查看>>
禁止http 缓存的方法
查看>>
python windows下安装pip(三)
查看>>
Android图像处理(二)--Paint,Canvas,ColorMatrix详细
查看>>
Android 百度地图
查看>>
iOS 架构(起手式)
查看>>
FilterDispatcher处理流程
查看>>
基于云平台部署应用的三种方式
查看>>
正确使用 Volatile 变量
查看>>
我的友情链接
查看>>
持续集成
查看>>