POJ 2719
#include<iostream>
#include<stdio.h>
using namespace std;
int dight[];
int _pow(int m,int n);
int main(){
//freopen("test.txt","r",stdin);
int i;
int num;
dight[] = ;
dight[] = ;
for(i = ; i < ; i++)
{
dight[i] = _pow(,i-) + dight[i-] + *dight[i-];
}
while(cin>>num){
if(num == )
break;
int j;
int k = ;
int temp;
temp = num;
int sum = ;
while(temp)
{
j = temp%;
temp /= ;
if(j > )
{
sum += _pow(,k);
sum += dight[k]*(j-);
}
else
sum += dight[k]*j;
k++;
}
cout<<num<<": "<<num-sum<<endl;
}
system("pause");
}
int _pow(int m,int n)
{
if(n == )
return ;
else if( == n)
return m;
else
return m*_pow(m,n-);
}
POJ 2719的更多相关文章
- poj 2719 Faulty Odometer
Description You are given a car odometer which displays the miles traveled as an integer. The odomet ...
- 2719:陶陶摘苹果-poj
2719:陶陶摘苹果 总时间限制: 1000ms 内存限制: 65536kB 描述 陶陶家的院子里有一棵苹果树,每到秋天树上就会结出10个苹果.苹果成熟的时候,陶陶就会跑去摘苹果.陶陶有个30厘米 ...
- poj 3373 Changing Digits (DFS + 记忆化剪枝+鸽巢原理思想)
http://poj.org/problem?id=3373 Changing Digits Time Limit: 3000MS Memory Limit: 65536K Total Submi ...
- poj和hdu部分基础算法分类及难度排序
最近想从头开始刷点基础些的题,正好有个网站有关于各大oj的题目分类(http://www.pythontip.com/acm/problemCategory),所以写了点脚本把hdu和poj的一些题目 ...
- POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理
Halloween treats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7644 Accepted: 2798 ...
- POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理
Find a multiple Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7192 Accepted: 3138 ...
- POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治
The Pilots Brothers' refrigerator Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22286 ...
- POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法
Flip Game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 37427 Accepted: 16288 Descr ...
- POJ 3254. Corn Fields 状态压缩DP (入门级)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9806 Accepted: 5185 Descr ...
随机推荐
- Tomcat服务器的安装和配置
一.Tomcat下载 可以直接从Apache的网站上下载Tomcat(http://tomcat.apache.org/),进入首页后,在左边Download一栏可选择你要下载的版本,点击便可进入To ...
- PHP-CGI、FASTCGI和php-fpm的关系
首先,CGI是干嘛的?CGI是为了保证web server传递过来的数据是标准格式的,方便CGI程序的编写者. web server(比如说nginx)只是内容的分发者.比如,如果请求/index.h ...
- java常用设计模式总览
一.java的设计模式大体上分为三大类: 创建型模式(5种):工厂方法模式,抽象工厂模式,单例模式,建造者模式,原型模式. 结构型模式(7种):适配器模式,装饰器模式,代理模式,外观模式,桥接模式,组 ...
- MySQL/Oracle视图的创建与使用
1.什么是视图? 视图是一个虚拟的表,是一个表中的数据经过某种筛选后的显示方式,视图由一个预定义的查询select语句组成. 2.视图的特点. 视图中的数据并不属于视图本身,而是属于基本的表,对视 ...
- Tensflow预测股票实例
import pandas as pd import numpy as np import matplotlib.pyplot as plt import tensorflow as tf #———— ...
- Silverlight 预定义颜色速查表
预定义颜色 可以使用 SolidColorBrush 绘制,它使用预定义纯色.这可以是 Colors 的静态属性 (Property) 名称,也可以是指定为 XAML 属性 (Attribu ...
- [转]Windows中使用命令行方式编译打包Android项目
http://my.oschina.net/liux/blog/37875 网上很多用Ant来编译打包Android应用的文章,毕竟Ant是纯Java语言编写的,具有很好的跨平台性.今天想写个纯win ...
- windows安装mysql 5.7
1.下载mysql 5.7 压缩包,解压在D:\software\mysql\目录下,更名称mysql-5.7.22 ,并新建data空文件夹和my.ini文件 my.ini文件的内容 [client ...
- poj3253哈夫曼树
Fence Repair Time Limit: 2000 MS Memory Limit: 65536 KB 64-bit integer IO format: %I64d , %I64u Java ...
- UITableView横向滚动
UITableView 设置 CGRect tableViewRect = CGRectMake(0.0, 0.0, 50.0, 320.0); self.tableView = [[UITableV ...