POJ 2346 Lucky tickets
来源:互联网 发布:access和sqlserver 编辑:程序博客网 时间:2024/05/14 04:29
Description
The public transport administration of Ekaterinburg is anxious about the fact that passengers don't like to pay for passage doing their best to avoid the fee. All the measures that had been taken (hard currency premiums for all of the chiefs, increase in conductors' salaries, reduction of number of buses) were in vain. An advisor especially invited from the Ural State University says that personally he doesn't buy tickets because he rarely comes across the lucky ones (a ticket is lucky if the sum of the first three digits in its number equals to the sum of the last three ones). So, the way out is found — of course, tickets must be numbered in sequence, but the number of digits on a ticket may be changed. Say, if there were only two digits, there would have been ten lucky tickets (with numbers 00, 11, ..., 99). Maybe under the circumstances the ratio of the lucky tickets to the common ones is greater? And what if we take four digits? A huge work has brought the long-awaited result: in this case there will be 670 lucky tickets. But what to do if there are six or more digits?
So you are to save public transport of our city. Write a program that determines a number of lucky tickets for the given number of digits. By the way, there can't be more than 10 digits on one ticket.
So you are to save public transport of our city. Write a program that determines a number of lucky tickets for the given number of digits. By the way, there can't be more than 10 digits on one ticket.
Input
Input contains a positive even integer N not greater than 10. It's an amount of digits in a ticket number.
Output
Output should contain a number of tickets such that the sum of the first N/2 digits is equal to the sum of the second half of digits.
Sample Input
4
Sample Output
670
流氓方法……先把结果都算出来,然后if判断给出答案……
if210;
if4670;
if655252;
if84816030;
if10 432457640;
DP方法还在想……
- POJ 2346 Lucky tickets
- poj 2346 Lucky tickets
- POJ 2346 Lucky tickets [DP]
- 据说是水DP Lucky tickets POJ 2346
- POJ-2346 Lucky tickets(线性DP)
- 【POJ】2346 - Lucky tickets(数位dp)
- POJ 2346 Lucky tickets(数位dp求前几位数字和)
- 2346 Lucky tickets 解题报告
- lucky tickets
- pku2346 Lucky tickets
- ural 1036 Lucky Tickets
- CF64 C. Lucky Tickets
- ural 1036 Lucky Tickets
- Timus 1036 Lucky Tickets
- ural 1036 Lucky tickets
- poj2346--Lucky tickets+DP
- Ural 1036 Lucky Tickets
- Ural1044-Lucky Tickets. Easy!
- Linq基本语法
- 第一篇
- CERL2 系列6:SDL,面向数据流的网络协议
- 集合框架
- va_list : C语言中的可变参数
- POJ 2346 Lucky tickets
- struts1配置文件
- SSH中web的配置
- python3的资料太少了
- 开心又迷茫。
- 探讨用or exit()简化条件语句
- const char**与char**赋值
- [转]什么是 WBS
- 成长中........