Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
127075 张泽辰 计算机病毒 C++ 通过 100 1 MS 304 KB 1303 2024-01-24 21:46:36

Tests(10/10):


#include<bits/stdc++.h> using namespace std; int a[101][101]; char b[101][101]; int main() { int n, m, ans = 0; cin >> n; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { cin >> b[i][j]; if (b[i][j] == '@') { a[i][j] = 1; ans++; } } } cin >> m; for (int t = 1; t <= m; t++) { for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (a[i][j] == t) { for (int y = 0; y <= 2; y += 2) { if (b[i - 1 + y][j] == '*') { ans++; b[i - 1 + y][j] = '@'; a[i - 1 + y][j] = t + 1; } if (b[i][j - 1 + y] == '*') { ans++; b[i][j - 1 + y] = '@'; a[i][j - 1 + y] = t + 1; } } } } } } cout << ans << endl; return 0; }


测评信息: