描述

编程精确计算2的N次方。(N是介于100和1000之间的整数)。

输入

正整数N (100N1000)

输出

2N次方

样例输入

200

样例输出

1606938044258990275541962092341162602522202993782792835301376

#include<iostream>
using namespace std;
int main()
{
int a[350]={0};
int n;
cin>>n;
int i,j,f=1;
a[0]=1;
for(i=0;i<n;i++)
{
int b[350]={0};
for(j=0;j<349;j++)
{
a[j]*=2;
if(a[j]>9)
{
a[j]%=10; b[j]=1;
}
}
for(j=0;j<349;j++)
{
if(b[j]==1) a[j+1]+=1;
}
}
for(i=349;i>=0;i--)
{
if(a[i]==0&&f==1)
continue;
f=0;
cout<<a[i];
}
cout<<endl;
return 0;
}

  

1009-2的N次方的更多相关文章

  1. acm.njupt 1001-1026 简单题

    点击可展开上面目录 Acm.njupt 1001-1026简单题 第一页许多是简单题,每题拿出来说说,没有必要,也说不了什么. 直接贴上AC的代码.初学者一题题做,看看别人的AC代码,寻找自己的问题. ...

  2. 2的N次方 【转】

    题目的链接为:http://acm.njupt.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1009 题目为: 2的N次 ...

  3. 1001 数组中和等于K的数对 1002 数塔取数问题 1003 阶乘后面0的数量 1004 n^n的末位数字 1009 数字1的数量

    1001 数组中和等于K的数对 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 给出一个整数K和一个无序数组A,A的元素为N个互不相同的整数,找出数组A中所有和等于K ...

  4. 51Nod 1003 1004 1009

    1003 阶乘后面0的数量 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 n的阶乘后面有多少个0? 6的阶乘 = 1*2*3*4*5*6 = 720,720后面有1 ...

  5. 51nod 1009:数字1的数量

    1009 数字1的数量 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题  收藏  关注 给定一个十进制正整数N,写下从1开始,到N的所有正数,计算出其中出现所有1的个 ...

  6. HDOJ 1009. Fat Mouse' Trade 贪心 结构体排序

    FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  7. [LeetCode] Super Pow 超级次方

    Your task is to calculate ab mod 1337 where a is a positive integer and b is an extremely large posi ...

  8. [LeetCode] Power of Four 判断4的次方数

    Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Gi ...

  9. [LeetCode] Power of Three 判断3的次方数

    Given an integer, write a function to determine if it is a power of three. Follow up:Could you do it ...

  10. [LeetCode] Power of Two 判断2的次方数

    Given an integer, write a function to determine if it is a power of two. Hint: Could you solve it in ...

随机推荐

  1. Change http port in bitnami stack

    My case goes like this. I installed bitnami redmine first with port 80 for http service, but got pro ...

  2. Qt获得网页源码

    1.工程中添加网络模块 打开你的.pro文件插入以下代码 QT += network 2.添加代码 CodeQString NetWork::getWebSource(QUrl url) { QNet ...

  3. linux命令之grep用法介绍

    Linux系统中grep命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹 配的行打印出来.grep全称是Global Regular Expression Print,表示全局正则表达 ...

  4. [WinForm]TextBox只能输入数字或者正浮点型数字

    关键代码: /// <summary> /// 只能输入数字[KeyPress事件] /// </summary> /// <param name="textB ...

  5. Redis 一:安装篇

    .安装环境,虚拟机 + centos6. PS::前提已经安装了yum的情况下 第一步:安装 mkdir /usr/redis 新建redis目录 cd /usr/redis 进入目录 wget ht ...

  6. php Smarty date_format [格式化时间日期]

    Example 5-8. date_format[日期格式] index.php: 复制代码代码如下: $smarty = new Smarty; $smarty->assign('yester ...

  7. linux常用命令收集(持续中)

    mv  :  既可以重命名,又可以移动文件或文件夹 例子:将目录A重命名为B mv A B 例子:将/a目录移动到/b下,并重命名为c mv /a /b/c 其实在文本模式中要重命名文件或目录的话也是 ...

  8. Linux环境下GIT初次使用

    Git是一个功能强大的分布式版本控制系统,最初用来作Linux内核代码管理的. 第一次接触到github是关于一个报道:在2013年1月15日晚间,全球最大的社交编程及代码托管网站GitHub突然疑似 ...

  9. 7、XAML的编译过程

    对于动态皮肤场景来说,在运行时加载和解析XAML是有意义的,对于那些没有支持XAML编译的.NET语言也是有意义的.但大多数WPF项目会通过MSBuild和Visual Studio完成XAML编译. ...

  10. JS类库函数收集中....

    实现string的substring方法 方法一:用charAt取出截取部分 String.prototype.mysubstring=function(beginIndex,endIndex){ v ...