问题 I: Common Knowledge

时间限制: 1 Sec  内存限制: 64 MB
提交: 9  解决: 8
[提交][状态][讨论版]

题目描述

Alice and Bob play some game in which they score points. Each of the two has an n-digit scoreboard which depicts numbers in base 10 (with leading zeroes). The digits 0 to 9 are displayed on a seven-segment display in the following fashion:

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.

输入

The input consists of:
• one line with an integer n (1 ≤ n ≤ 20), where n is the number of digits.

输出

Output the number of score pairs that can be displayed on two n-digit scoreboards and are fully known by both players.

样例输入

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_快速幂的更多相关文章

  1. 【板子】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 ...

  2. jiulianhuan 快速幂--矩阵快速幂

    题目信息: 1471: Jiulianhuan 时间限制: 1 Sec  内存限制: 128 MB 提交: 95  解决: 22 题目描述 For each data set in the input ...

  3. 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 ...

  4. CodeForces 227E Anniversary (斐波那契的高妙性质+矩阵快速幂)

    There are less than 60 years left till the 900-th birthday anniversary of a famous Italian mathemati ...

  5. BNU 4356 ——A Simple But Difficult Problem——————【快速幂、模运算】

    A Simple But Difficult Problem Time Limit: 5000ms Memory Limit: 65536KB 64-bit integer IO format: %l ...

  6. BNU29139——PvZ once again——————【矩阵快速幂】

    PvZ once again Time Limit: 2000ms Memory Limit: 65536KB 64-bit integer IO format: %lld      Java cla ...

  7. codeforces 696C C. PLEASE(概率+快速幂)

    题目链接: C. PLEASE time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  8. CodeChef Sereja and LCM(矩阵快速幂)

    Sereja and LCM   Problem code: SEALCM   Submit All Submissions   All submissions for this problem ar ...

  9. 小总结:快速幂+贪心————Bit Mask____UVA 10718 多多去理解去温习哦!

    传送门:https://vjudge.net/problem/UVA-10718 Preview: bitstream:a flow of data in binary form. in bit-wi ...

随机推荐

  1. [译]git init

    git init git init命令用来创建一个新的Git仓储.可以用在一个已经存在的但是没有受Git版本控制的项目,或者用来初始化一个全新的没有任何文件的空仓储.git init通常是你开始一个新 ...

  2. tc 147 2 PeopleCircle(再见约瑟夫环)

    SRM 147 2 600PeopleCircle Problem Statement There are numMales males and numFemales females arranged ...

  3. webrtc第二篇 聊天室

    聊天室模型不一样考虑的问题也不一样 1.websocket文本聊天 * step1 : 向聊天室所有用户(不包括该用户自己)发送当前用户上线信息.客户端用户栏回添加此用户 * step2 : 将该用户 ...

  4. JS快速获取图片宽高的方法

    快速获取图片的宽高其实是为了预先做好排版样式布局做准备,通过快速获取图片宽高的方法比onload方法要节省很多时间,甚至一分钟以上都有可能,并且这种方法适用主流浏览器包括IE低版本浏览器. 我们一步一 ...

  5. C#调用java类、jar包方法

    一.将已经编译后的java中Class文件进行打包:打包命令JAR 如:将某目录下的所有class文件夹全部进行打包处理: 使用的命令:jar cvf test.jar -C com/ . 其中tes ...

  6. DAY1 linux 50条命令

    1. tar压缩,解压缩 tar -cvf *** (压缩) tar -xvf ***  (解压缩) [root@bogon ~]# tar cvf test.tar test/ test/ test ...

  7. img标签src=""和background-image:url();引发两次请求页面bug

      img标签src=""和background-image:url();引发两次请求页面bug 具体原因是,在img 对象的src 属性是空字符串("")的时 ...

  8. leetcode 82. Remove Duplicates from Sorted List II

    Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numb ...

  9. CSS技巧-rgba函数的妙用

    先简单介绍一下: rgba()函数是平时开发中经常遇到的,这篇文章也做了一个比较详细的解读以及一系列的应用. 对它的工作原理做一番分析:就是具有一定透明度的盒子: 还比较了rgba()函数和不透明度属 ...

  10. caffe学习系列(3):数据层介绍

    一个模型由多个层构成,如Data,conv,pool等.其中数据层是模型的最底层,是模型的入口. 提供数据的输入,也提供数据从Blobs转换成别的格式进行保存输出还包括数据的预处理(如减去 均值, 放 ...