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 ...
随机推荐
- ref out
http://zhidao.baidu.com/link?url=lff7FilmowvV8DW_jbJNgdauhsQTBOYnZdq1sgq349k6Uo1nTv7CZvdWR1hK7DBPnNi ...
- Google翻译请求(难点是tk参数)
业务需求需要将一些文字翻译一下··· 但是直接调用接口收费啊啊啊啊(貌似是前几百万字免费,然后就开始收费了)···· 就想研究一下Google翻译接口... 想模拟Google向服务器发送一个Http ...
- 快速切换IP的批处理!
内容如下: @echo off color 1A Title [SMART专用 IP设置V1.0] cls echo. echo SMART专用 IP设置V1.0 %date%%time% echo. ...
- nyoj 364 田忌赛马(贪心)
田忌赛马 时间限制:3000 ms | 内存限制:65535 KB 难度:3 描述 Here is a famous story in Chinese history. "That ...
- [转]C++模板学习
1. 模板的概念. 我们已经学过重载(Overloading),对重载函数而言,C++的检查机制能通过函数参数的不同及所属类的不同.正确的调用重载函数.例如,为求两个数的最大值,我们定义MAX()函数 ...
- 微信电话本可免费拨打网络电话 通话一分钟约300K流量
微信电话本新版本于昨日晚间发布,这是一款智能通讯增强软件,通话双方都下载此APP并开通免费通话功能就能使用微信电话本拨打免费网络电话,在对方无法接通情况下还能将音频转向语音信箱,微信电话本目前支持An ...
- ios 防止按钮快速点击造成多次响应的避免方法。
- (void)starButtonClicked:(id)sender { //先将未到时间执行前的任务取消. [[self class] cancelPreviousPerformRequests ...
- Triangle leetcode
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent n ...
- Java File 常用操作回顾
最近项目中要用到File这个类,温故而知新,回过头来回顾下这个File类,File类主要是对磁盘目录,文件进行操作的Api,具体其实查JDK api 的File全能获取到. 下面写一些文件目录的基本操 ...
- HDU 4939 Stupid Tower Defense(dp)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4939 解题报告:一条长度为n的线路,路上的每个单元格可以部署三种塔来给走在这条路上的敌人造成伤害,第一 ...