CF630I.Parking Lot
普及+/提高
通过率:0%
时间限制:0.50s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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 (2_n_ - 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.
为了快速招聘高技能专家,IT 城市一家新兴的 IT 公司采取了一项前所未有的举措:为每位员工配备一辆汽车,且每位员工可从四种不同品牌中任选其一。
办公楼前的停车场由一条包含 2n−2 个停车位的直线构成。不幸的是,汽车总数超过了停车场的容量;更甚者,每种品牌的汽车数量均超过了停车位总数!因此,停车场上永远没有空位。
公司首席执行官望着这条笔直排列的汽车队列,心想:若停车场中恰好存在 n 个连续的同品牌汽车,则会更加美观。请帮助首席执行官计算满足该条件的停车方案数。
输入格式
The only line of the input contains one integer n (3 ≤ n ≤ 30) — the amount of successive cars of the same make.
输入仅包含一行,其中有一个整数 n(3 ≤ n ≤ 30)——表示连续同品牌汽车的数量。
输出格式
Output one integer — the number of ways to fill the parking lot by cars of four makes using the described way.
输出一个整数——按照上述方法用四种品牌的汽车填满停车场的方案数。
输入输出样例
输入#1
3
输出#1
24
说明/提示
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.
我们用以下方式表示汽车品牌:A — 阿斯顿·马丁(Aston Martin),B — 宾利(Bentley),M — 迈巴赫(Mercedes-Maybach),Z — 扎波罗热茨(Zaporozhets)。当 $ n = 3 $ 时,停车场的合法填充方式如下:
AAAB AAAM AAAZ ABBB AMMM AZZZ BBBA BBBM BBBZ BAAA BMMM BZZZ MMMA MMMB MMMZ MAAA MBBB MZZZ ZZZA ZZZB ZZZM ZAAA ZBBB ZMMM
最初计划提供法拉利(Ferrari)、兰博基尼(Lamborghini)、玛莎拉蒂(Maserati)和布加迪(Bugatti)品牌的跑车,但该方案被否决了,因为这些车型离地间隙较小,无法在 IT 城年久失修的道路上行驶。
输入解题思路,AI测评打分。不知道怎么写?