3016 Proton Impact cannon II

Source: Internet
Author: User

3016 Proton impact cannon II

time limit: 1 sspace limit: 32000 KBtitle level: Golden Gold SolvingView Run ResultsTitle Description Description

"Sorry data Error ~ ~ has been fixed"

The EU is simply too greedy. After completing his cooperation with the Soviet Union, he continued to engage with the Soviet Union after the killing of Yuri. Unfortunately, in the meantime, the legendary Little Japan (The Rising Sun Empire) is incredibly powerful. The Allies re-cooperated with the Soviets in preparation for the annihilation of Japan. After Little Love (Einstein), many allied scientists worked together to invent the second generation of lightning storms: the proton impact cannon. It has the advantage of short cooling time and great power. Each time an attack occurs, five proton energy shells fall together in the enemy's base, causing devastating blows. The disadvantage is that the shells first hit the outer space and then fell into the enemy's home, the time flies too long. The Allied bosses can't wait to know how many buildings this attack can destroy in Japan, so please program your help to calculate it. The data is detailed in the input description.

Enter a description Input Description

The first row n of the input indicates the size of the enemy camp.

The input of section 2~n+1, which indicates the input of an enemy camp chart. Each element in the camp diagram consists of 0-9. 0 means there are no buildings, and the remaining numbers indicate the current building's blood volume values. (by default, each building occupies a square).

The next five elements of the input represent the center of the placement of the five proton energy shells, indicating that the placement is at some point in the Cartesian coordinate system. The Proton energy cannon has 2 damage to the center, causing a bit of damage to the other eight squares at the center of the nine grid. If a point of building blood is bombarded to 0 or less, the building is said to have been destroyed.

Output description Output Description

Only one row, the number of buildings destroyed.

Sample input Sample Input

5

0 3 1) 2 4

1 3 4) 1 0

0 0 3) 4 1

1 3 4) 5 0

0 0 9) 0 0

1 2

2 2

4 3

4 3

2 4

Sample output Sample Output

8

Data range and Tips Data Size & Hint

(Point A, point B) means column B of row A

The original question was wrong, I corrected it.

By the way the data is strengthened (the adjacency matrix of the maximum 1000*1000);

Category labels Tags Click here to expand

Analysis: no Need for analysis

Code:

#include <iostream>#include<cstdio>#include<cstring>using namespacestd; Short inta[1010][1010],n,ans;intMain () {scanf ("%d",&N);  for(intI=1; i<=n;i++){         for(intj=1; j<=n;j++) {scanf ("%d",&A[i][j]); if(a[i][j]==0) a[i][j]=- -; }    }     for(intI=1, x,y;i<=5; i++) {scanf ("%d%d",&x,&y); A[x][y]-=2; if(X-1>=1) a[x-1][y]--; if(x+1<=n) a[x+1][y]--; if(Y1>=1) a[x][y-1]--; if(y+1<=n) a[x][y+1]--; if(X-1>=1&&y-1>=1) a[x-1][y-1]--; if(x+1<=n&&y+1<=n) a[x+1][y+1]--; if(X-1>=1&&y+1<=n) a[x-1][y+1]--; if(x+1<=n&&y-1>=1) a[x+1][y-1]--; }     for(intI=1; i<=n;i++){         for(intj=1; j<=n;j++){            if(a[i][j]<=0&&a[i][j]>- -) {ans++; }}} printf ("%d\n", ans); return 0;}

3016 Proton Impact cannon II

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.