题目链接

水题,LA我居然没找到在那里。

 #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <iostream>
using namespace std;
#define LL long long
LL dp[],bin[];
int que[],s;
void judge(int x)
{
s = ;
while(x)
{
que[s++] = x%;
x /= ;
}
}
int main()
{
int i;
LL temp,n,x;
temp = ;
bin[] = ;
for(i = ;i <= ;i ++)
bin[i] = *bin[i-];
for(i = ;i <= ;i ++)
{
if(i% == )
{
dp[i] = temp*;
temp *= ;
}
else
{
dp[i] = dp[i-];
}
}
while(cin>>n&&n)
{
for(i = ;i <= ;i ++)
{
if(n > dp[i])
n -= dp[i];
else
{
if(i == )
cout<<n<<endl;
else if(i == )
cout<<n<<n<<endl;
else if(i% == )
{
x = bin[i/] + n - ;
cout<<x;
judge(x);
for(i = ;i < s;i ++)
cout<<que[i];
cout<<endl;
}
else
{
x = bin[i/-] + n - ;
cout<<x;
judge(x);
for(i = ;i < s;i ++)
cout<<que[i];
cout<<endl;
}
break;
}
}
}
return ;
}

POJ 2402 Palindrome Numbers的更多相关文章

  1. POJ 2402 Palindrome Numbers(LA 2889) 回文数

    POJ:http://poj.org/problem?id=2402 LA:https://icpcarchive.ecs.baylor.edu/index.php?option=com_online ...

  2. POJ2402/UVA 12050 Palindrome Numbers 数学思维

    A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example,the ...

  3. Palindrome Numbers(LA2889)第n个回文数是?

     J - Palindrome Numbers Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu ...

  4. Uva - 12050 Palindrome Numbers【数论】

    题目链接:uva 12050 - Palindrome Numbers 题意:求第n个回文串 思路:首先可以知道的是长度为k的回文串个数有9*10^(k-1),那么依次计算,得出n是长度为多少的串,然 ...

  5. Poj 2247 Humble Numbers(求只能被2,3,5, 7 整除的数)

    一.题目大意 本题要求写出前5482个仅能被2,3,5, 7 整除的数. 二.题解 这道题从本质上和Poj 1338 Ugly Numbers(数学推导)是一样的原理,只需要在原来的基础上加上7的运算 ...

  6. E - Palindrome Numbers

    题目链接:https://vjudge.net/contest/237394#problem/E A palindrome is a word, number, or phrase that read ...

  7. POJ 1159 Palindrome(字符串变回文:LCS)

    POJ 1159 Palindrome(字符串变回文:LCS) id=1159">http://poj.org/problem? id=1159 题意: 给你一个字符串, 问你做少须要 ...

  8. UVa 12050 - Palindrome Numbers (回文数)

    A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example, th ...

  9. POJ 3974 Palindrome

    D - Palindrome Time Limit:15000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Sub ...

随机推荐

  1. Linux 下 Console / 控制台 复制粘贴快捷键

    Linux下复制粘贴快捷键 1. 在终端下: 复制命令:Ctrl + Shift + C  组合键. 粘贴命令:Ctrl + Shift + V  组合键. 2. 在控制台下: 复制命令:Ctrl + ...

  2. 【翻译二十】-java线程池

    Thread Pools Most of the executor implementations in java.util.concurrent use thread pools, which co ...

  3. Babelfish(二分查找,字符串的处理略有难度,用sscanf输入)

    Babelfish Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 28581   Accepted: 12326 题目链接: ...

  4. mysql 如何设置自动增长序列 sequence(一)

    背景:由于项目需要,必须用mysql设置主键自增长,而且想用字符串的.经过上网查找并且实验,终于做出了一套方案.现在就共享给大家! 解决思路:由于mysql不带sequence,所以要手写的,创建一张 ...

  5. nodejs2

    jade@1.11.0 严格注意缩进 extends layout block content h1= title p Welcome to #{title} - var a='abc'; p his ...

  6. Java Security: Illegal key size or default parameters?

    来自:http://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters I ...

  7. C[泊车管理系统]

    // //  main.c //  泊车管理系统 // //  Created by 丁小未 on 13-7-14. //  Copyright (c) 2013年 dingxiaowei. All ...

  8. Codeforces Round #276 (Div. 1) E. Sign on Fence 二分+主席树

    E. Sign on Fence   Bizon the Champion has recently finished painting his wood fence. The fence consi ...

  9. linux常用命令和选项

    (1)比较两个文件. diff filename1 filename2 -y -W number; -y 并列格式输出 -W 并列格式输出时指定的列宽 (2)linux下抓包 tcpdump有三类关键 ...

  10. DrawerLayout

        一.概述       DrawerLayout是官方提供的侧滑菜单,相比SliddingMenu,它更加轻量级.默认情况下,DrawerLayout可以设置左侧或者右侧滑出菜单.如下,   x ...