ural 1217. Unlucky Tickets

1217. Unlucky Tickets

Time limit: 1.0 second
Memory limit: 64 MB
Strange people live in Moscow! Each time in the bus, getting a ticket with a 6-digit number, they try to sum up the first half of digits and the last half of digits. If these two sums are equal, they suppose such a ticket to be a lucky one. A person, who owns the lucky ticket, should dream about something, eat the ticket (no, it’s not made of chocolate, it’s made of paper!) and the dream will come true… At least, they believe it!
Strange people live in St.Petersburg! Each time in the bus, getting a ticket with a 6-digit number, they try to sum up the digits on the odd positions and the digits on the even positions. If these two sums are equal, they suppose such a ticket to be a lucky one. A person, who owns the lucky ticket, should dream about something, eat the ticket (no, even in St. Petersburg lucky tickets are not made of chocolate, they’re made of paper!) and the dream will come true… At least, they believe it!
In the "third Russian capital" — Yekaterinburg — we laugh about such strange ideas. We are practical. We are not superstitious, even a little bit. But we understand that too much luck cannot be good. Thus we consider every ticket, which is lucky both in "Moscow sense" and "St. Petersburg sense" to be unlucky. If we get an unlucky ticket in the bus, we throw it away and leave the bus immediately! Two examples of unlucky tickets are 472175 and 810513.
You are to write a program, which calculates the total number of unlucky  N-digit tickets.

Input

The input contains a single even positive integer  N (2 ≤  N ≤ 20) — the number of digits in the ticket. Please note, that, for example 00742544 is a valid 8-digit ticket (by the way, it is a St.Petersburg-style lucky ticket).

Output

Your program should output a single integer number — the total number of unlucky  N-digit tickets.

Sample

inputoutput
4
100
Problem Author: Leonid Volkov
Problem Source: The Seventh Ural State University collegiate programming contest
Tags: none   ( hide tags for unsolved problems )

转载于:https://www.cnblogs.com/StupidBoy/p/4893038.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值