[Offer收割]编程练习赛51 register

Ended

Participants:280

Verdict:Accepted
Score:100 / 100
Submitted:2018-03-18 12:33:16

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<stack>
#include<array>
#include<queue>
#include <math.h>
#include <map>  
#include <iomanip>  
#include <unordered_set>  
#include <unordered_map>  
using namespace std;
int cal(vector<vector<bool>> &t,int n, int m, int x, int y, int a, int b, int c, int d) {
    int ans = 1;
    t[x][y] = true;
    if (x + a < n&&y + b < m&&x+a>=0&&y+b>=0&&(a!=0||b!=0)&&t[x+a][y+b]==false)
        ans += cal(t,n, m, x + a, y + b, a, b, c, d);
    if (x + c < n&&y + d < m&&x + c >= 0 && y + d >= 0 && (c != 0 || d!= 0) && t[x + c][y + d] == false)
        ans += cal(t,n, m, x + c, y + d, a, b, c, d);
    return ans;
}
int main()
{
    int n;
    cin >> n;
    vector<string> a(n);
    unordered_set<string> e;
    int count = 0;
    for (int i = 0;i < n;i++)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX