I -
Parking Lot

Crawling in process...
Crawling failed
Time Limit:500MS    
Memory Limit:65536KB     64bit IO Format:%I64d & %I64u

Description

To quickly hire highly skilled specialists one of the new IT City companies made an unprecedented move. Every employee was granted a car, and an employee can choose one of four different car makes.

The parking lot before the office consists of one line of
(2n - 2) parking spaces. Unfortunately the total number of cars is greater than the parking lot capacity. Furthermore even amount of cars of each make is greater than the amount of parking spaces! That's why there are no free spaces on the parking
lot ever.

Looking on the straight line of cars the company CEO thought that parking lot would be more beautiful if it contained exactly
n successive cars of the same make. Help the CEO determine the number of ways to fill the parking lot this way.

Input

The only line of the input contains one integer n (3 ≤ n ≤ 30) — the amount of successive cars of the same make.

Output

Output one integer — the number of ways to fill the parking lot by cars of four makes using the described way.

Sample Input

Input
3
Output
24

Sample Output

Hint

Let's denote car makes in the following way: A — Aston Martin, B — Bentley, M — Mercedes-Maybach, Z — Zaporozhets. For
n = 3 there are the following appropriate ways to fill the parking lot: AAAB AAAM AAAZ ABBB AMMM AZZZ BBBA BBBM BBBZ BAAA BMMM BZZZ MMMA MMMB MMMZ MAAA MBBB MZZZ ZZZA ZZZB ZZZM ZAAA ZBBB ZMMM

Originally it was planned to grant sport cars of Ferrari, Lamborghini, Maserati and Bugatti makes but this idea was renounced because it is impossible to drive these cars having small road clearance on the worn-down roads of IT City.

2*n-2个停车位,4种类型的车,n辆同一类型的A车要停在一起,旁边也不能是同一类型的A,问有多少种方法

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
__int64 a=3*n-1;
__int64 aa=n-3;
__int64 ans=a*3*pow(4,aa);
printf("%lld\n",ans);
}
return 0;
}

Codeforces--630I--Parking Lot(规律)的更多相关文章

  1. codeforces D. Queue 找规律+递推

    题目链接: http://codeforces.com/problemset/problem/353/D?mobile=true H. Queue time limit per test 1 seco ...

  2. codeforces 630 I(规律&&组合)

    I - Parking Lot Time Limit:500MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Subm ...

  3. Codeforces 626B Cards(模拟+规律)

    B. Cards time limit per test:2 seconds memory limit per test:256 megabytes input:standard input outp ...

  4. Codeforces 46D Parking Lot

    传送门 D. Parking Lot time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  5. ●CodeForces 480E Parking Lot

    题链: http://codeforces.com/problemset/problem/480/E题解: 单调队列,逆向思维 (在线的话应该是分治做,但是好麻烦..) 离线操作,逆向考虑, 最后的状 ...

  6. Codeforces 219E Parking Lot 线段树

    Parking Lot 线段树区间合并一下, 求当前要占的位置, 不包括两端点的写起来方便一点. #include<bits/stdc++.h> #define LL long long ...

  7. Segments CodeForces 909B (找规律)

    Description You are given an integer N. Consider all possible segments (线段,划分)on the coordinate axis ...

  8. Really Big Numbers CodeForces - 817C (数学规律+二分)

    C. Really Big Numbers time limit per test 1 second memory limit per test 256 megabytes input standar ...

  9. CodeForces 42C Safe cracking 规律题

    题目链接:点击打开链接 3个数为一组,找最大的一个数让它降低,则显然是有解的,分类讨论一下就可以 #include<cstdio> #include<cstring> #inc ...

  10. CodeForces - 1003-B-Binary String Constructing (规律+模拟)

    You are given three integers aa, bb and xx. Your task is to construct a binary string ssof length n= ...

随机推荐

  1. JS高级——词法作用域

    作用域 1.js中没有块级作用域 2.如果有块级作用域,那么下面代码将会是undefined undefined <script> for (var i = 0; i < 10; i ...

  2. html5——多媒体(三)

    自定义进度条 1.video标签是内联块,可以设置宽高,但是需要用大盒子将其包裹起来进行定位 2.小盒子设计成进度条样式,并进行定位 3.进度条样式中的特殊按钮可以用web字体 4.通过点击实现视频的 ...

  3. c#——值类型与引用类型

    值类型传的是值 引用类型传的是地址

  4. C#连接Sqlite 出现:混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该程序集。的解决方案

    C#连接Sqlite 出现: 混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该程序集.的解决方案 C#连接sqlite数据库代码 ...

  5. 文件下载之ServletOutputStream

    使用response.getOutputStream可以获取ServletOutputStream,从而实现向页面发送流数据.但是需要注意的是,不能使用ajax进行请求,因为这样页面不会有任何反应,可 ...

  6. Escaping Closures 两点:本质是生命周期标示符

    1.block需要(拷贝)保存: 2.block引用的环境变量需要处理. 相当于oc中的copy block. Escaping Closures A closure is said to escap ...

  7. PHP 之文件锁解决并发问题

    一.参数说明 $handle: 文件资源 $operation: 锁的类型 LOCK_SH: 共享锁 LOCK_EX: 排他锁 LOCK_UN: 释放锁 $wouldblock: 设置为true的时候 ...

  8. PHP 设计模式--基础

    设计模式的宗旨就是:重用. 在面向对象中,类是用于生成对象的代码模版,而设计模式是用于解决共性问题的代码模版. 遵循这样的模板,我们可以设快速地设计出优秀的代码. 注意,设计模式只是模板,不是具体的代 ...

  9. 控制台输出(System.out.printf)的使用

    一.  介绍 System.out.printf 与 C语言中的 printf 使用方法类似,可以向控制台(Console) 输出指定格式的内容.使用  System.out.printf 的方法比使 ...

  10. [forward] cmake, CMakeLists.txt梳理

    cmake intro 原文请见 cmake使用总结(转)-工程主目录CMakeList文件编写 在 Linux 下进行开发很多人选择编写 makefile 文件进行项目环境搭建,而makefile ...