transfer LCT Run away , Brush the water and adjust it .

 #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int a[],n,m,f[],ans;
bool cal()
for (int i=;i<=n;i++) {f[i+]=a[i]-f[i]-f[i-];}
if (a[n]-f[n]-f[n-]) return ;
else return ;
int main()
for (int i=;i<=n;i++) scanf("%d",&a[i]);
if (a[]==) ans+=cal();
else if (a[]==)
return ;


I believe everyone has played the game of minesweeping . It was in a city n*m There's some ray in the matrix , I want you to find ray based on some information . It's Halloween ,“ more than ” A simple minesweeping game has become popular in China , The rules of the game are the same as mine sweeping , If there's no thunder in a grid , So the number in it and it 8 The number of rays in a connected lattice . Now the chessboard is n×2 Of , Some of the lattices in the first column are ray , And there's no thunder in the second column , Here's the picture : Because the first column of mine may have a variety of programs to meet the second column of the number of restrictions , Your task is to determine the number of placement options for the first row of mines according to the information in the second row .


First act N, The second line has N Number , In turn, the numbers in the second column of the lattice .(1<= N <= 10000)


a number , That is, the number of placement schemes of mines in the first column .

Sample Input

1 1

Sample Output






【BZOJ1088】[SCOI2005] Mine clearance Mine More related articles on recursion

  1. 【BZOJ1088】 Mine clearance ( Recurrence )

    [BZOJ1088] Mine clearance ( Recurrence ) Topic BZOJ Answer key Suddenly found that this is a funny forced topic . Just enumerate what the first one is , The back can be pushed out .. #include<iostream> using n ...

  2. Luogu P2327 [SCOI2005] Mine clearance 【 Recurrence / mathematics 】By cellur925

    Subject portal It's been a long time . It seems that we should play more minesweeping in the future qwq. In fact, there are only three answers to this question :0.1.2. For all the first columns , As long as the first number and the second number are determined , In fact, the whole sequence is determined , We can get... From this recursion sec[i-] ...

  3. P2327 [SCOI2005] Mine clearance ( Recurrence )

    Topic link : Title Description I believe everyone has played the game of minesweeping . It was in a city $n*m$ There's some ray in the matrix , I want you to find ray based on some information ...

  4. BZOJ1088 [SCOI2005] Mine clearance Mine Dynamic programming

    Welcome to visit ~ The source of the original text is —— Blog Garden -zhouzhendong Go to the blog Garden to see the solution Subject portal - BZOJ1088 Topic summary Mine clearance . Only 2 That's ok . The first 2 OK, no thunder , The first line has thunder . Tell you the array shown on the second line , There are several ways to put them ...

  5. 【 Answer key 】 bzoj1088: [SCOI2005] Mine clearance Mine ( It's amazing )

    bzoj1088, Too lazy to copy , Poke me, poke me Solution: Actually, there is a conclusion , The answer is just \(0\),\(1\),\(2\) Three ( I'm really a weak chicken , I can't think of that ) Then we assume that the first one can push out all the States ( display ...

  6. BZOJ1088: [SCOI2005] Mine clearance Mine

    This question A I don't know 2333 Portal Pressure DP, Enumerate the distribution of the last mine (1<<3)-1, And then combine it with the current distribution , Roll out the next state . //BZOJ 1088 //by Cydiater //2 ...

  7. 【 violence 】【 deduction 】bzoj1088 [SCOI2005] Mine clearance Mine

    Consider whether a grid on the right is thundering , It can only affect the three lattices on the left . in other words , If the two squares next to the one on the left have been thunder , For the third grid, it's the only one . Therefore, we only enumerate whether the first two lattices are thundering or not , The rest of the violence is legal . ...

  8. [BZOJ1088][SCOI2005] Mine clearance Mine DP

    Topic link : Record the situation of each grid corresponding to the left grid , then dp Just transfer . #include&l ...

  9. 【 Recurrence 】BZOJ 1088: [SCOI2005] Mine clearance Mine

    1088: [SCOI2005] Mine clearance Mine Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 2275  Solved: 1328[Submit][St ...

Random recommendation

  1. ASP.NET operation Cookie Detailed explanation increase , modify , Delete

    Cookie, Sometimes in the plural Cookies, Refers to the data stored on the user's local terminal by some websites in order to identify the user's identity ( Usually encrypted ). Defined in RFC2109. It's a former employee of Netscape Lou Montulli stay 1993 year 3 ...

  2. [ original ] from Oracle and Microsoft Sql Server Migrate to PostgreSQL Plus Advanced Server

    One . understand PPAS How to move 1. Online migration and offline migration use Migration Studio or Migration Toolkit Direct to PPAS Database object definition and data table data migration is called online migration , Generate the object to be migrated ...

  3. sharePoint Common commands

    New-SPStateServiceDatabase -Name "StateServiceDatabase" | New-SPStateServiceApplication -N ...

  4. Use... Between components Prop To transfer data

    <div id="example"> <father></father> </div> <script src="h ...

  5. NOIP2009T3 The best trade

    The valley gate See this question , I wanted to go from the back to the front dfs, Find the point where you can get to the end , And back and forth in these points spfa, Use the difference between the commodity prices of two cities on one side as the edge weight , After implementation , We find that there are negative edge weights in the graph , There's a circuit , And all kinds of strange things ...

  6. P1577 Cut the rope

    P1577 Cut the rope Title Description Yes N A rope , Their lengths are Li. If you cut it out of them K Two of the same length Rope , this K How long can each rope last ? Keep the answer after the decimal point 2 position . I / O format Input format : The first line has two integers N ...

  7. Format time turns UTC Time

    public void dateChange() throws ParseException { String str="2010-5-27 12:10:12"; SimpleDa ...

  8. summary Javascript Various methods of array de duplication in

    I believe we all know about Javascript There are many ways to de duplicate arrays in , This article gives you a summary Javascript Various methods of array de duplication in , I believe this article is helpful for you to learn and use Javascript It has certain reference value , In need ...

  9. docker Package the running container as a mirror

    Package the container into a mirror image docker commit -a "" -m "my apache" Container name or id Packaged image name : label OPTIONS ...

  10. js Realization jquery function animate Animation effect

    <script> function animate(obj, json, interval, sp, fn) { clearInterval(obj.timer); function ge ...