问题 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. linux脚本编程(shell)浅介 (转载)

    linux脚本(shell)编程 啊,昨天上网看到一篇讲 linux/unix shell 的文章,想想自己最后写这东西也是一年前的事了,想想都快忘光了. 还是整理一下,做一次回顾,以后说不定还用得上 ...

  2. R You Ready?——大数据时代下优雅、卓越的统计分析及绘图环境

    作者按:本文根据去年11月份CSDN举办的“大数据技术大会”演讲材料整理,最初发表于2012年2月期<程序员>杂志. 0  R 的安装

  3. Java字节流:FileInputStream FileOutputStream

    ----------------------------------------------------------------------------------- FileInputStream ...

  4. wtforms 使用

    wtforms是一个表单模板库, 下面以修改密码表单为例简单说明其用法. 我们可以用python代码定义form的基本元素, 比如用户名/邮箱, 并给定各个元素的validation条件. 然后在re ...

  5. 【解决】同一url的http请求所获取的结果总是相同

    曾经在WP7写过一个通过HTTP获取网页内容的小程序,当时一直没能够解决: 有一个网址,在每次点击刷新之后页面所呈现的内容都是不同的.但是进行HTTP请求时,结果将会一直重复. 从网上查资料得知,在请 ...

  6. [转]看了这个才发现jQuery源代码不是那么晦涩

    很多人觉得jquery.ext等一些开源js源代码 十分的晦涩,读不懂,遇到问题需要调试也很费劲.其实我个人感觉主要是有几个方面的原因: 对一些js不常用的语法.操作符不熟悉 某个function中又 ...

  7. CSS相邻兄弟选择器

    相邻兄弟选择器定义:选择紧接在另一个元素后的元素,而且两者有着相同的父元素. 代码一:<body> <h1>This is a heading.</h1> < ...

  8. mac os 基本命令

    unix 系统命令行 ,仅供参考   目录操作   命令名 功能描述 使用举例   mkdir 创建一个目录 mkdir dirname   rmdir 删除一个目录 rmdir dirname   ...

  9. AChartEngine 安卓折线图 柱形图等利器

    http://www.eoeandroid.com/thread-548233-1-6.html 最近公司项目中要用到折线图,状态类型的图标要用到折线图,柱形图等,并且能够动态显示,在网上找了许多de ...

  10. Java多线程基础知识(二)

    一. Java线程具有6种状态  NEW 初始状态,线程被创建,但是还没有调用start方法. RUNNABLE 运行状态,java线程将操作系统中的就绪和运行两种状态笼统的称作进行中. BLOCKE ...