zoukankan      html  css  js  c++  java
  • [BZOJ]|[Ural] Formula 1-----插头DP入门

    1519. Formula 1

    Time limit: 1.0 second
    Memory limit: 64 MB

    Background

    Regardless of the fact, that Vologda could not get rights to hold the Winter Olympic games of 20**, it is well-known, that the city will conduct one of the Formula 1 events. Surely, for such an important thing a new race circuit should be built as well as hotels, restaurants, international airport - everything for Formula 1 fans, who will flood the city soon. But when all the hotels and a half of the restaurants were built, it appeared, that at the site for the future circuit a lot of gophers lived in their holes. Since we like animals very much, ecologists will never allow to build the race circuit over the holes. So now the mayor is sitting sadly in his office and looking at the map of the circuit with all the holes plotted on it.

    Problem

    Who will be smart enough to draw a plan of the circuit and keep the city from inevitable disgrace? Of course, only true professionals - battle-hardened programmers from the first team of local technical university!.. But our heroes were not looking for easy life and set much more difficult problem: "Certainly, our mayor will be glad, if we find how many ways of building the circuit are there!" - they said.
    It should be said, that the circuit in Vologda is going to be rather simple. It will be a rectangleN*M cells in size with a single circuit segment built through each cell. Each segment should be parallel to one of rectangle's sides, so only right-angled bends may be on the circuit. At the picture below two samples are given for N = M = 4 (gray squares mean gopher holes, and the bold black line means the race circuit). There are no other ways to build the circuit here.
    Problem illustration

    Input

    The first line contains the integer numbers N and M (2 ≤ NM ≤ 12). Each of the next N lines contains M characters, which are the corresponding cells of the rectangle. Character "." (full stop) means a cell, where a segment of the race circuit should be built, and character "*" (asterisk) - a cell, where a gopher hole is located.

    Output

    You should output the desired number of ways. It is guaranteed, that it does not exceed 263-1.

    Samples

    inputoutput
    4 4
    **..
    ....
    ....
    ....
    
    2
    
    4 4
    ....
    ....
    ....
    ....
    
    6
    
    Problem Author: Nikita Rybak, Ilya Grebnov, Dmitry Kovalioff
    Problem Source: Timus Top Coders: Third Challenge
    本文作者:xrdog 作者博客:http://www.cnblogs.com/Dragon-Light/ 转载请注明出处,侵权必究,保留最终解释权!
  • 相关阅读:
    seo课程教程笔记公布【网络转载】
    建立一个windows服务(可用于实现计划任务,事件监控..) .NET
    运行界面上,实现随意拖动控件 .NET
    定时关机的小程序 .NET
    服务 安装与删除 .NET
    模拟鼠标/键盘 .NET实现
    Google Code 创建开源项目
    一个批处理文件 启动停止服务.bat
    提升搜索引擎中网站排名的工具[持续更新中..]
    DateTime.Now.ToString()用法
  • 原文地址:https://www.cnblogs.com/Dragon-Light/p/6262218.html
Copyright © 2011-2022 走看看