UVA 12050 - Palindrome Numbers 模拟

题目大意:给出i,输出第i个镜像数,不能有前导0.
题解:从外层开始模拟
#include <stdio.h>
int p(int x)
{
int sum, i;
;i<=x;i++)
sum *= ;
return sum;
}
int main()
{
], c;
while(~scanf("%d", &n))
{
)
break;
i=;
*p((i-)/))
{
n -= *p((i-)/);
i++;
}
c = (i+)/;
t=;
while(c)
{
c--;
cs[t]=;
while(n>p(c))
{
n -= p(c);
cs[t]++;
}
t++;
}
cs[]++;
;j<t;j++)
printf("%d", cs[j]);
==)
printf(]);
;j>=;j--)
printf("%d", cs[j]);
printf("\n");
}
;
}
UVA 12050 - Palindrome Numbers 模拟的更多相关文章
- Uva - 12050 Palindrome Numbers【数论】
题目链接:uva 12050 - Palindrome Numbers 题意:求第n个回文串 思路:首先可以知道的是长度为k的回文串个数有9*10^(k-1),那么依次计算,得出n是长度为多少的串,然 ...
- POJ2402/UVA 12050 Palindrome Numbers 数学思维
A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example,the ...
- UVa 12050 - Palindrome Numbers (回文数)
A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example, th ...
- UVa - 12050 Palindrome Numbers (二分)
Solve the equation: p ∗ e −x + q ∗ sin(x) + r ∗ cos(x) + s ∗ tan(x) + t ∗ x 2 + u = 0 where 0 ≤ x ≤ ...
- UVA - 13022 Sheldon Numbers(位运算)
UVA - 13022 Sheldon Numbers 二进制形式满足ABA,ABAB数的个数(A为一定长度的1,B为一定长度的0). 其实就是寻找在二进制中满足所有的1串具有相同的长度,所有的0串也 ...
- UVa 10006 - Carmichael Numbers
UVa 10006 - Carmichael Numbers An important topic nowadays in computer science is cryptography. Some ...
- Palindrome Numbers(LA2889)第n个回文数是?
J - Palindrome Numbers Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu ...
- 2017ecjtu-summer training #1 UVA 12050
A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example, th ...
- UVa - 12050
A palindrome is a word, number, or phrase that reads the same forwards as backwards. For example,the ...
随机推荐
- 解决maven编译spark1.5报错问题
spark1.5发布了,赶紧去下了源码尝鲜 git clone git://github.com/apache/spark.git -b branch-1.5 输入命令进行编译 ./make-dist ...
- FM000
SQL> select To_char(1,'000') from dual; TO_C----001 注意最左边有一个空格 SQL> select To_char(1,'FM000') ...
- session与cookie的讲解
session_start();//开启session http,无状态性 记录状态SESSION COOKIE SESSION :存储在服务端(器)的:每个人存一份:可以存储任意类型的数据:默认过期 ...
- Yii增删改查操作
增: 1 第一种 $post=new Post; $post->title='sample post'; $post->content='content for the sample po ...
- dota玩家与英雄契合度的计算器,python语言scrapy爬虫的使用
首发:个人博客,更新&纠错&回复 演示地址在这里,代码在这里. 一个dota玩家与英雄契合度的计算器(查看效果),包括两部分代码: 1.python的scrapy爬虫,总体思路是pag ...
- loadrunner具体实例教你如何进行结果分析
1.对于吞吐量,单位时间内吞吐量越大,说明服务器的处理能越好,而请求数仅表示客户端向服务器发出的请求数,与吞吐量一般是成正比关系. 2.一般瓶颈应该就是某个因素在不断增加,某个相关性能指标也会不断增加 ...
- Asp.net的post提交方式
//建立WebRequest对象,url目标地址HttpWebRequest req =(HttpWebRequest)WebRequest.Create(url); //将LoginInfo转换为b ...
- jquery选择器中两个class是什么意思?
jquery选择器中两个class是什么意思? $(".class1 .class2") 选择class1元素下class2的元素(中间有空格)$(".class1.cl ...
- 将Nagios监控信息存入Mysql
一.NDOUtils安装需求: nagios:安装方法:http://www.cnblogs.com/Richardzhu/p/3340638.html mysql:源码安装方法:http://www ...
- win7下80端口被(Pid=4)占用的解决方法
首先介绍一种网上普遍的方法,就是查找占据80端口的进程,然后关闭它就行了. 1.运行cmd,然后输入netstat -a -n -o,回车:2.查看开头几行包含0.0.0.0:80的那一行最后的pid ...