当前位置:网站首页>Electronic Society C language level 1 32, calculate the power of 2
Electronic Society C language level 1 32, calculate the power of 2
2022-07-02 01:33:00 【dllglvzhenfeng】
Method 1 :
/*
Electronics Association C Language 1 level 32、 Calculation 2 The power of Method 1
Given a nonnegative integer n, seek 2n.
Input
An integer n.0 <= n < 31.
Output
An integer , namely 2 Of n Power .
The sample input
3
Sample output
8
*/
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n;
cin>>n;
cout<<pow(2,n);
return 0;
}
/*
12: Calculation 2 Of N Power
http://noi.openjudge.cn/ch0106/12/
2809: Calculation 2 Of N Power
http://bailian.openjudge.cn/practice/2809/
13: To calculate by power
http://noi.openjudge.cn/ch0105/13/
*/Method 2 :
/*
Electronics Association C Language 1 level 32、 Calculation 2 The power of Method 2
Given a nonnegative integer n, seek 2^n.
Input
An integer n.0 <= n < 31.
Output
An integer , namely 2 Of n Power .
The sample input
3
Sample output
8
*/
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n,ans=1;
cin>>n;
for(int i=1;i<=n;i++)
{
ans*=2;
}
cout<<ans<<endl;
return 0;
}
/*
12: Calculation 2 Of N Power
http://noi.openjudge.cn/ch0106/12/
2809: Calculation 2 Of N Power
http://bailian.openjudge.cn/practice/2809/
13: To calculate by power
http://noi.openjudge.cn/ch0105/13/
*/Links to related topics :
12: Calculation 2 Of N Power
OpenJudge - 12: Calculation 2 Of N Power
2809: Calculation 2 Of N Power
OpenJudge - 2809: Calculation 2 Of N Power
13: To calculate by power
OpenJudge - 13: To calculate by power
Ah C Language The first 1 Chapter Programming changes thinking ( The first 0 speak )
Ah C Language The first 2 Chapter Dream of direct flight ( The first 1-8 speak )
Ah C Language The first 3 Chapter The battle has just begun ( The first 9-15 speak )
Ah C Language The first 4 Chapter Heavyweights on stage ( The first 16-23 speak )
Ah C Language The first 5 Chapter The good play is behind ( The first 24-25 speak )
Ah C Language The first 6 Chapter Oh my god ! A string of numbers is approaching ( The first 26 speak )
Ah C Language The first 7 Chapter With it you can do more ( The first 27-28 speak )
Ah C Language The first 8 Chapter It's game time ( The first 29 speak )
边栏推荐
- 只是以消费互联网的方式和方法来落地和实践产业互联网,并不能够带来长久的发展
- Learning note 24 - multi sensor post fusion technology
- Modeling essays series 124 a simple coding method
- matlab 使用 audiorecorder、recordblocking录制声音,play 播放声音,audiowrite 保存声音
- MySQL application day02
- Design and control of multi rotor aircraft (VII) -- sensor calibration and measurement model
- [Obsidian] wechat is sent to Obsidian using remotely save S3 compatibility
- [dynamic planning] interval dp:p3205 Chorus
- Android high frequency network interview topic must know and be able to compare Android development environment
- Pyldavis installation and use | attributeerror: module 'pyldavis' has no attribute' gensim '| visual results are exported as separate web pages
猜你喜欢

Feature extraction and detection 16 brisk feature detection and matching

Hcip day 14 (MPLS protocol)

Matlab uses audiorecorder and recordblocking to record sound, play to play sound, and audiobook to save sound

Unity AssetBundle subcontracting

MPLS experiment operation

2022年6月国产数据库大事记

卷积神经网络(包含代码与相应图解)

Day 13 of hcip (relevant contents of BGP agreement)

It's already 30. Can you learn programming from scratch?

卷積神經網絡(包含代碼與相應圖解)
随机推荐
学习笔记3--高精度地图关键技术(上)
About asp Net core uses a small detail of datetime date type parameter
SAP ui5 beginner tutorial 20 - explanation of expression binding usage of SAP ui5
微信小程序中使用tabBar
Game thinking 15: thinking about the whole region and sub region Services
Data visualization in medical and healthcare applications
Datawhale community blackboard newspaper (issue 1)
[dynamic planning] interval dp:p3205 Chorus
Basic usage of shell script
Four basic strategies for migrating cloud computing workloads
6-3 vulnerability exploitation SSH environment construction
Matlab uses resample to complete resampling
Part 29 supplement (XXIX) basis of ECMAScript
笔者更加愿意将产业互联网看成是一个比消费互联网要丰富得多的概念
首场“移动云杯”空宣会,期待与开发者一起共创算网新世界!
matlab 实现语音信号重采样和归一化,并播放比对效果
MPLS experiment operation
Pyldavis installation and use | attributeerror: module 'pyldavis' has no attribute' gensim '| visual results are exported as separate web pages
Learning note 3 -- Key Technologies of high-precision map (Part 1)
Leetcode 45 Jumping game II (2022.02.14)