Beautiful Palindrome Number

Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1067    Accepted Submission(s): 691

Problem Description
A positive integer x can represent as (a1a2…akak…a2a1)10 or (a1a2…ak−1akak−1…a2a1)10 of a 10-based notational system, we always call x is a Palindrome Number. If it satisfies 0<a1<a2<…<ak≤9, we call x is a Beautiful Palindrome Number.
Now, we want to know how many Beautiful Palindrome Numbers are between 1 and 10N.
 
Input
The first line in the input file is an integer T(1≤T≤7), indicating the number of test cases.
Then T lines follow, each line represent an integer N(0≤N≤6).
 
Output
For each test case, output the number of Beautiful Palindrome Number.
 
Sample Input
2
1
6
 
Sample Output
9
258
 
Source
 
打表模拟
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <stack>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long LL;
/*void init(int test)
{
int n = 1;
for(int i=1; i<=test; i++)
{
n*=10;
}
int a[10],cnt=0;
for(int i=1; i<=n; i++)
{
int m = i;
int id = 1;
while(m)
{
a[id++] = m%10;
m/=10;
}
bool flag = true;
for(int k=1,j=id-1; k<=j; k++,j--)
{
if(a[k]!=a[j])
{
flag = false;
break;
}
}
if(flag)
{
id = id-1;
flag = true;
for(int k=2; k<=id/2; k++)
{
if(a[k]<=a[k-1]) flag = false;
}
if(id%2==1&&id!=1){
if(a[id/2]>=a[id/2+1]) flag = false;
}
if(flag) {
printf("%d\n",i);
cnt++;
}
}
}
printf("%d\n",cnt);
}*/
int a[]={,,,,,,};
int main()
{
/*int test;
while(true){
scanf("%d",&test);
init(test);
}*/
int tcase;
scanf("%d",&tcase);
while(tcase--){
int n;
scanf("%d",&n);
printf("%d\n",a[n]);
}
return ;
}

hdu 5062(水题)的更多相关文章

  1. HDU-1042-N!(Java大法好 &amp;&amp; HDU大数水题)

    N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Subm ...

  2. HDU 5391 水题。

    E - 5 Time Limit:1500MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Statu ...

  3. hdu 1544 水题

    水题 /* * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #i ...

  4. HDU排序水题

    1040水题; These days, I am thinking about a question, how can I get a problem as easy as A+B? It is fa ...

  5. hdu 2710 水题

    题意:判断一些数里有最大因子的数 水题,省赛即将临近,高效的代码风格需要养成,为了简化代码,以后可能会更多的使用宏定义,但是通常也只是快速拿下第一道水题,涨自信.大部分的代码还是普通的形式,实际上能简 ...

  6. Dijkstra算法---HDU 2544 水题(模板)

    /* 对于只会弗洛伊德的我,迪杰斯特拉有点不是很理解,后来发现这主要用于单源最短路,稍稍明白了点,不过还是很菜,这里只是用了邻接矩阵 套模板,对于邻接表暂时还,,,没做题,后续再更新.现将这题贴上,应 ...

  7. hdu 5162(水题)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5162 题解:看了半天以为测试用例写错了.这题玩文字游戏.它问的是当前第i名是原数组中的第几个. #i ...

  8. hdu 3357 水题

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3357 #include <cstdio> #include <cmath> # ...

  9. hdu 5038 水题 可是题意坑

    http://acm.hdu.edu.cn/showproblem.php?pid=5038 就是求个众数  这个范围小 所以一个数组存是否存在的状态即可了 可是这句话真恶心  If not all ...

随机推荐

  1. web在线调试

    xx <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta h ...

  2. 21、AngularJs知识点总结 part-3

    1.选择框select 在 AngularJS 中我们可以使用 ng-option 指令来创建一个下拉列表,列表项通过对象和数组循环输出,也可以使用ng-repeat 指令来创建下拉列表: 区别:ng ...

  3. PHP vscode+XDebug 远程断点调试服务器上的代码

    对于简单的项目或仅仅想知道某一位置的某个变量是什么值,直接使用var_dump配置exit来打印和中断就可以了,方便又快捷, 而对于大型项目的调试,或想了解某个系统的整个运行过程,xdebug可能会是 ...

  4. Python MySQLdb 模块使用方法

    import MySQLdb 2.和数据库建立连接 conn=MySQLdb.connect(host="localhost",user="root",pass ...

  5. 爬虫:Scrapy8 - Item Pipeline

    当 Item 在 Spider 中被收集之后,它将会被传递到 Item Pipeline,一些组件会按照一定的顺序执行对 Item 的处理. 每个 item pipeline 组件(有时也称之为“It ...

  6. php 数据库内容增删改查----增

    首先,建立一个主页面(crud.php) <!DOCTYPE html> <html lang="en"> <head> <meta ch ...

  7. HDU 4101 Ali and Baba (思路好题)

    与其说这是个博弈,倒不如说是个搜索.这题思路不错,感觉很难把情况考虑周全. 在地图外围填充一圈0,两次BFS,第一次从-1点出发,把从-1到达的0点以及包围0的那一圈石头标记出来.如下图: 1 1 1 ...

  8. ocrosoft Contest1316 - 信奥编程之路~~~~~第三关 问题 E: IQ(iq)

    http://acm.ocrosoft.com/problem.php?cid=1316&pid=4 题目描述 根据世界某权威学会的一项调查,学信息学的学生IQ非常高.举个最好的例子,如果我们 ...

  9. Python中的单元测试模块Unittest快速入门

    前言 为什么需要单元测试? 如果没有单元测试,我们会遇到这种情况:已有的健康运行的代码在经过改动之后,我们无法得知改动之后是否引入了Bug.如果有单元测试的话,只要单元测试全部通过,我们就可以保证没有 ...

  10. [bzoj] 1043 下落的圆盘 || 圆上的“线段覆盖”

    原题 n个圆盘,求下落后能看到的总周长. 红色即为所求 借鉴于黄学长的博客 对于每下落的一个圆盘,处理他后面的圆盘会挡住哪些区域,然后把一整个圆(2\(/pi\))当做一整个区间,每个被覆盖的部分都可 ...