Common Knowledge_快速幂
问题 I: Common Knowledge
时间限制: 1 Sec 内存限制: 64 MB
提交: 9 解决: 8
[提交][状态][讨论版]
题目描述

For some odd reason, the two players cannot see the scoreboards entirely. Alice can only see the lower half of her own scoreboard and the upper half of Bob’s scoreboard. Bob can only see the upper half of his scoreboard and the upper half of Alice’s scoreboard. Here, ‘half’ is meant to
include the horizontal segments in the digits’ centers: they can be seen by both players at all times. For example, if one sees the upper half of an eight, one can conclude that the digit is not a zero.

A pair of n-digit scores is called fully known if both players know both scores (i.e. all 2n digits) by looking at the displays with their restricted vision. The players cannot communicate.
输入
• one line with an integer n (1 ≤ n ≤ 20), where n is the number of digits.
输出
样例输入
10
样例输出
1073741824
#include <iostream>
#include <cstdio>
#include <algorithm> using namespace std; int main()
{
int x=;
long long int mi;
int n;
while(scanf("%d",&n)!=EOF){
mi=x;
if(n==){
printf("1\n");
continue;
}
for(int i=;i<n;){
if(i<n/){
mi*=mi;
i*=;
}else{
mi*=x;
i+=;
}
}
printf("%lld\n",mi);
mi=;
}
return ;
}
Common Knowledge_快速幂的更多相关文章
- 【板子】gcd、exgcd、乘法逆元、快速幂、快速乘、筛素数、快速求逆元、组合数
1.gcd int gcd(int a,int b){ return b?gcd(b,a%b):a; } 2.扩展gcd )extend great common divisor ll exgcd(l ...
- jiulianhuan 快速幂--矩阵快速幂
题目信息: 1471: Jiulianhuan 时间限制: 1 Sec 内存限制: 128 MB 提交: 95 解决: 22 题目描述 For each data set in the input ...
- Codeforces Round #209 (Div. 2)A贪心 B思路 C思路+快速幂
A. Table time limit per test 1 second memory limit per test 256 megabytes input standard input outpu ...
- CodeForces 227E Anniversary (斐波那契的高妙性质+矩阵快速幂)
There are less than 60 years left till the 900-th birthday anniversary of a famous Italian mathemati ...
- BNU 4356 ——A Simple But Difficult Problem——————【快速幂、模运算】
A Simple But Difficult Problem Time Limit: 5000ms Memory Limit: 65536KB 64-bit integer IO format: %l ...
- BNU29139——PvZ once again——————【矩阵快速幂】
PvZ once again Time Limit: 2000ms Memory Limit: 65536KB 64-bit integer IO format: %lld Java cla ...
- codeforces 696C C. PLEASE(概率+快速幂)
题目链接: C. PLEASE time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- CodeChef Sereja and LCM(矩阵快速幂)
Sereja and LCM Problem code: SEALCM Submit All Submissions All submissions for this problem ar ...
- 小总结:快速幂+贪心————Bit Mask____UVA 10718 多多去理解去温习哦!
传送门:https://vjudge.net/problem/UVA-10718 Preview: bitstream:a flow of data in binary form. in bit-wi ...
随机推荐
- 修改emlog表字段名称
在em_twitter表中增加一个字段. ,添加一个字段isImportant alter table em_twitter add isImprotant ) not ; ,把字段isImprota ...
- CSS鼠标响应事件经过、移动、点击示例介绍
本文为大家介绍下CSS 鼠标响应事件:鼠标经过CSS.鼠标移动CSS.鼠标点击CSS以及示例,喜欢的朋友可以参考下 几种鼠标触发CSS事件. 说明: onMouseDown 按下鼠标时触发 onM ...
- List之Union(),Intersect(),Except()
http://www.cnblogs.com/qinpengming/archive/2012/12/03/2800202.html List之Union(),Intersect(),Except() ...
- [译]git pull
git pull把git fetch和git merge压缩成了一条命令. 用法 git pull <remote> 作用和git fetch <remote> &&a ...
- XML文件数据操作
#region XML序列化文件和反序列化 /// <summary> /// 通用类的保存函数,可以将已经声明过可序列化的类以文件方式保存起来. /// 保存格式分为 XML明文式和 二 ...
- php导出csv数据在浏览器中输出提供下载或保存到文件的示例
来源:http://www.jb51.net/article/49313.htm 1.在浏览器输出提供下载 /** * 导出数据到CSV文件 * @param array $data 数据 * @pa ...
- 如何获取到Android控件的高度
问题 如何获取一个控件的长和高,相信很多朋友第一眼看见这个问题都会觉得很简单,直接在onCreate里面调用getWidth.getMeasuredWidth不就可以获得了吗,但是,事实上是并没有简单 ...
- 在framework中打包xib
废话不多说,直接上图 1.Copy Bundle Resources 中加入相关xib 2.这里是重点,调用的时候不能直接写 [[NSBundle mainBundle] loadNibNamed:@ ...
- 单链表的类的c++实现
#include<iostream> using namespace std;template <class T>struct linkNode{ T data; linkNo ...
- Python自动化之sqlalchemy关联查询
外键关联 from sqlalchemy import ForeignKey from sqlalchemy.orm import relationship class Address(Base): ...