UVa 10624:Super Number, Rujia Liu的神题

链接:

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=112&page=show_problem&problem=1565

原题:

Don't you think 162456723 very special? Look at the picture below if you are unable to find its speciality. (a | b means ‘b is divisible bya’)

Figure: Super Numbers

Given n, m (0 < n < m < 30), you are to find a m-digit positive integer X such that for every i (n <= i <= m), the first i digits of X is a multiple of i. If more than one such X exists, you should output the lexicographically smallest one. Note that the first digit of X should notbe 0.

Input

The first line of the input contains a single integer t(1 <= t <= 15), the number of test cases followed. For each case, two integers n and mare separated by a single space.

Output

For each test case, print the case number and X. If no such number, print -1.

样例输入:

2

1 10

3 29

样例输出:

Case 1: 1020005640

Case 2: -1

题目大意:

所谓的超级数字,就是指一个数字,从左边位数开始, 前i位能被i整数

输入n, m,   第n为开始要满足超级数字的要求。

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索find
, super
You
liurujia daima、rujia、nvyongrujia、rujiajiudian、rujia1,以便于您获取更多的相关知识。

时间: 2024-11-27 15:09:16

UVa 10624:Super Number, Rujia Liu的神题的相关文章

UVa 11218:KTV, Rujia Liu的神题(一)

链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=112&page=show_problem&problem=2159 类型:   暴力回溯 原题: One song is extremely popular recently, so you and your friends decided to sing it in KTV. The song has 3 c

UVa 10274:Fans and Gems, 神牛Rujia Liu的神题(三)

题目链接: UVa :  http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1215 zoj    : http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1237 类型:  隐式图搜索+恶心模拟+哈希判重+bfs+dfs 原题: Tomy's

UVa 11198:Dancing Digits,Rujia Liu的神题

题目链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2139 类型: 隐式图搜索,  BFS, 哈希判重,模拟 原题: Digits like to dance. One day, 1, 2, 3, 4, 5, 6, 7 and 8 stand in a line to have a wonderful

uva 10624 Super Number 回溯

  暴力回溯,用位运算加个奇偶剪枝   注意取余的效率,因为取余实在太慢了,所以要最少的进行取余运算,所以就是每19位进行次取余,这样1s内就过了 /* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,please indicate the source** */ #include <stdio.h> int ans[50]; char nok(int now) { int i,

uva 10624 - Super Number

点击打开链接 题目意思:  给定n和m 现在要求找到一个m位数的树使得,对于m的前i位数都是i的倍数,n <= i <= m, 而且这个数的第一位数不能为0,如果找到就输出这个数,否则输出-1 解题思路:    1  目前只懂得用深搜回溯做,只是这一题的数据没有想象中的那么大,所以加上一些剪枝即可水过(数据强的话肯定TLE)                       2  我们知道这个解空间树有m层,每一层的可能取值有10种(第一个除外),那么最大的m = 29 ,那么时间复杂都就是 10^

uva 11991 Easy Problem from Rujia Liu?

点击打开链接uva 11991 思路: STL 分析: 1 题目要求的是第k个v的下标 2 题目的规模是10^6如果用暴力的话那么超时是肯定的,所以这里应该考虑用vector数组,每一个值作为一个vector,,然后把这个值出现在第几个位置插入vector,这样不仅可以知道这个值出现的次数,也能够知道第几个v的位置 代码: #include<vector> #include<cstdio> #include<cstring> #include<iostream&g

UVa 10013 Super long sums:简单高精度

10013 - Super long sums Time limit: 3.000 seconds http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=954 The Problem The creators of a new programming language D++ have found out that

UVa 10706:Number Sequence

链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1647 原题: A single positive integer i is given. Write a program to find the digit located in the position i in the sequence of n

uva 10591 - Happy Number hash

   非常简单的题,易知平方和后不超过800,开个800的数组,预处理,然后直接定址就可以了,不过要注意a和an的区别 /* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,please indicate the source** */ #include <iostream> #include <cstdio> #include <cstdlib> #in