<什么是数学>第一章习题
2011-05-02 17:40
323 查看
1.用以a=2,3,...,15为底,给0到1000的数字起名字,需要多少个不同的数字的名称?哪一种基底要求的数字名称最少?
写了个小程序来测试,答案是4,需要8个数字名称.
#include <stdio.h>
#define START_BASE 2
#define BASE_LIMIT 16
#define NUMBER 1001
int main(void)
{
int min_number_base = START_BASE;
int min_number_count = NUMBER;
int base;
int count;
int product;
for(base=START_BASE; base < BASE_LIMIT; base++)
{
count = base;
product = 1;
while((product *= base) < NUMBER)
{
count++;
}
if (count < min_number_count)
{
min_number_base = base;
min_number_count = count;
}
printf("base:%d\n",base);
}
printf("The min number of base is: %d\n",min_number_base);
printf("The count is: %d\n",min_number_count);
待续.......
写了个小程序来测试,答案是4,需要8个数字名称.
#include <stdio.h>
#define START_BASE 2
#define BASE_LIMIT 16
#define NUMBER 1001
int main(void)
{
int min_number_base = START_BASE;
int min_number_count = NUMBER;
int base;
int count;
int product;
for(base=START_BASE; base < BASE_LIMIT; base++)
{
count = base;
product = 1;
while((product *= base) < NUMBER)
{
count++;
}
if (count < min_number_count)
{
min_number_base = base;
min_number_count = count;
}
printf("base:%d\n",base);
}
printf("The min number of base is: %d\n",min_number_base);
printf("The count is: %d\n",min_number_count);
待续.......
相关文章推荐
- <<什么是数学>> 读书笔记 第一章
- <胡策day> 10.30 T1 小学数学
- <HDU 2089>不要62 (数位DP是什么?)
- <em>与<i>,<strong>与<b>有什么区别?
- <2014 10 01> 数学基础 Wikipedia
- <第一章>Node 学习笔记 |>Mac Node安装<|
- <!--内容//-->请问在CSS里面,这个符号是什么 意思?
- <a href="CustomerServlet?action=list">什么意思?
- JavaAPI中的<T>和<E>分别代表什么?
- <!doctype html>是什么意思?
- <转>SFTP 和FTPS的区别是什么?
- <?php $sql = <<<EOF 。。。。EOF;?>这种写法是什么意思
- <C++ Primer_5th>习题_1.4
- <![CDATA[ ]]> 是什么东东
- <数字图像处理基础与实践(matlab版)>第二章习题 给图片加水印
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">是什么意思?
- <meta property="qc:admins" content="70003766576320416375" />是什么意思?具体功能是什么?
- <<跟着老男孩学linux运维>>第一章总结
- <script type="javascript"> 与<script language="javascript"> 有什么区别啊
- <html lang="en">是什么意思