POJ 2402 Palindrome Numbers
水题,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的更多相关文章
- POJ 2402 Palindrome Numbers(LA 2889) 回文数
POJ:http://poj.org/problem?id=2402 LA:https://icpcarchive.ecs.baylor.edu/index.php?option=com_online ...
- POJ2402/UVA 12050 Palindrome Numbers 数学思维
A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example,the ...
- Palindrome Numbers(LA2889)第n个回文数是?
J - Palindrome Numbers Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu ...
- Uva - 12050 Palindrome Numbers【数论】
题目链接:uva 12050 - Palindrome Numbers 题意:求第n个回文串 思路:首先可以知道的是长度为k的回文串个数有9*10^(k-1),那么依次计算,得出n是长度为多少的串,然 ...
- Poj 2247 Humble Numbers(求只能被2,3,5, 7 整除的数)
一.题目大意 本题要求写出前5482个仅能被2,3,5, 7 整除的数. 二.题解 这道题从本质上和Poj 1338 Ugly Numbers(数学推导)是一样的原理,只需要在原来的基础上加上7的运算 ...
- E - Palindrome Numbers
题目链接:https://vjudge.net/contest/237394#problem/E A palindrome is a word, number, or phrase that read ...
- POJ 1159 Palindrome(字符串变回文:LCS)
POJ 1159 Palindrome(字符串变回文:LCS) id=1159">http://poj.org/problem? id=1159 题意: 给你一个字符串, 问你做少须要 ...
- UVa 12050 - Palindrome Numbers (回文数)
A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example, th ...
- POJ 3974 Palindrome
D - Palindrome Time Limit:15000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Sub ...
随机推荐
- 七牛:关于图片 EXIF 信息中旋转参数 Orientation 的理解
EXIF(Exchangeable Image File)是 “可交换图像文件” 的缩写,当中包含了专门为数码相机的照片而定制的元数据,可以记录数码照片的拍摄参数.缩略图及其他属性信息,简单来说,Ex ...
- Log4Net配置以及使用
跟踪程序代码,及时发现程序的运行状态,是每个成熟的软件所必不可少的一个环节,网站发布到真实的环境之后,对于程序的运行状态,我们并不能想开发环境那也,点击调试.日志记录显示就尤为重要,在.NET中记录日 ...
- react.js 多个组件集成示例
这个看得有点懵, 可能要结合其它实例看. html <!DOCTYPE html> <html> <head> <script src="http: ...
- postgresql设置默认的search_path
-- Use this to show the current search_path -- Should return: "$user",public SHOW search_p ...
- DevExpress DXperience 的本地化(汉化)方法
Devexpress的.net组件目前非常流行,在国内开发者中有非常高的热度,但是由于是国外控件,我们经常遇到的一个问题是汉化.目前Devexpress公司2011.2版以后使用了统一的本地化模式,针 ...
- form表单中的submit点击时阻止提交
在form 中增加onsubmit="return false;"属性.
- hdu 4272 2012长春赛区网络赛 dfs暴力 ***
总是T,以为要剪枝,后来发现加个map就行了 #include<cstdio> #include<iostream> #include<algorithm> #in ...
- 深入剖析iLBC的丢包补偿技术(PLC)
转自:http://blog.csdn.net/wanggp_2007/article/details/5136609 丢包补偿技术(Packet Loss Concealment——PLC)是iLB ...
- 深入分析JavaWeb 技术内幕
1,通过浏览器请求一个资源,会发生以下几种过程 1) http的解析过程,包括对于http请求头和响应头中指令(控制用户浏览器的渲染行为和 服务器的执行逻辑)的解析 2)DNS的解析过程(根据域名获取 ...
- 最实用的APP界面设计知识,有温度的APP设计(转)
在逛简书的时候,无意之间看到了这样的一篇非常有意思的app设计博文.顾25学堂的摘录了其中的一些关于移动端APP界面设计的精华.分享给25学堂的app设计师们. 当然,下面的这些app设计知识点是来自 ...