3.9 2的k次方小于m的k的最大值

3.9 2的k次方小于m的k的最大值

通过课程进入 题 号: 92 3.9 2的k次方小于m的k的最大值 语言要求: C++

编写程序,求满足公式的变量k的最大值:
2^k <= m
其中,m是程序输入的一个正整数。

2^k表示2的k次方。

输入输出格式要求:
输入格式:m回车
程序中要求全部使用unsigned int 类型数据。scanf和printf中使用%u
只输出运算结果,请不要输出其他字符。
例如:
输入:16回车
输出:4
输入:2140000000回车
输出:30

C代码:

#include<stdio.h>
#include<math.h>
int main()
{
	unsigned int m;
	int k;
	double i;
	scanf("%u",&m);
	i=(double)m;
	for(k=1;k<log(i)/log(2.0);k++);
	printf("%u",k-1);
	return 0;
}

测试结果:
在这里插入图片描述

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
As an AI language model, I can provide information on Python 3.9 and TensorFlow 2. Here is a brief overview: Python 3.9: Python 3.9 is the latest version of the Python programming language. It was released in October 2020 and comes with several new features and improvements. Some of the notable changes include: - Improved performance: Python 3.9 comes with several performance improvements, such as faster startup times and reduced memory usage. - New syntax features: Python 3.9 introduces new syntax features such as flexible function and variable annotations, as well as improved support for dictionaries. - Improved type hinting: Type hinting has been improved in Python 3.9, making it easier to write and maintain large codebases. - Other improvements: Python 3.9 also comes with several other improvements, such as improved string methods, new modules, and better error messages. TensorFlow 2: TensorFlow is an open-source machine learning framework developed by Google. TensorFlow 2 is the latest version of the framework, released in 2019. Some of the notable changes in TensorFlow 2 include: - Eager execution: TensorFlow 2 comes with eager execution enabled by default, making it easier to debug and develop models. - Keras integration: TensorFlow 2 has tighter integration with Keras, a popular high-level neural network API. This makes it easier to build and train deep learning models. - Improved performance: TensorFlow 2 comes with several performance improvements, such as better GPU support and improved data loading. - Other improvements: TensorFlow 2 also comes with several other improvements, such as improved support for distributed training, improved support for mobile and embedded devices, and improved visualization tools. In summary, Python 3.9 and TensorFlow 2 are both powerful tools for building machine learning models. Python 3.9 provides a range of new features and improvements, while TensorFlow 2 comes with improved performance and tighter integration with Keras. Together, they provide a powerful platform for building and training machine learning models.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值