CodeForces - 630I Parking Lot (数学排列组合)
来源:互联网 发布:微通话软件下载 编辑:程序博客网 时间:2024/04/28 05:52
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
3
24
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.
Source
#include<stdio.h>#include<string.h>#include<math.h>#include<algorithm>#define INF 0x3f3f3f3f#define ll long long#define N 10010#define M 1000000007using namespace std;int main(){int n;while(scanf("%d",&n)!=EOF){int m=3*n-1;int nn=n-3;ll sum=m*3*pow(4,nn);printf("%lld\n",sum);}return 0;}
- CodeForces - 630I Parking Lot (数学排列组合)
- CodeForces-630 I. Parking Lot【排列组合】
- CodeForces 630I:Parking Lot【排列组合】
- CodeForces 630 I. Parking Lot(组合数学)
- Codeforces--630I--Parking Lot(规律)
- codeforces 630I Parking Lot
- Codeforces 630I Parking Lot
- codeforces #630 I. Parking Lot
- codeforces 630 I Parking Lot (规律&&组合)
- Codeforces-46D Parking Lot
- 【codeforces】480E Parking Lot
- Codeforces 46D Parking Lot(贪心模拟)
- CodeForces 46D Parking Lot(线段树区间合并)
- codeforces 46D Parking Lot(线段树 区间合并)
- Codeforces Beta Round #43 D. Parking Lot
- Codeforces Beta Round #43 D. Parking Lot
- Codeforces 46D Parking Lot(线段树)
- Codeforces 46D Parking Lot 枚举
- 吉林大学,1477
- php的学习笔记之面向对象(一)
- #引导方案(一)#
- 登陆注册密码错误或者输入为空时震动效果
- oracle笔记(约束)
- CodeForces - 630I Parking Lot (数学排列组合)
- Activity的四种启动模式-图文并茂【Android】
- CentOS下的搭建Git服务器:Gitosis
- acm java1000
- 如何为eclipse装插件 使其类似IDE 可以查看.ftl文件
- ObjectInputStream解析
- 二叉树的层次遍历
- WebPack系列教程(五):使用
- Android---自定义Dialog、Toast