AtCoder Beginner Contest 197 B
種別: 記事
カテゴリ: 競技プログラミング
サブカテゴリ: AtCoder > AtCoder Beginner Contest 197
タグ: #解いた問題
(工事中)
2021年3月27日にAtCoder で開催されたコンテストであるAtCoder Beginner Contest 197 のB問題に関するメモ
解き方
解答例
下は上記の方法で解いたときの提出結果である。また、その提出の際に提出したソースコードをその下に転記する。
code: C
#include <stdio.h>
int main () {
int h = 0;
int w = 0;
int x = 0;
int y = 0;
char s100101 = {};
int res = 0;
int ans = 1;
int i = 1;
res = scanf("%d", &h);
res = scanf("%d", &w);
res = scanf("%d", &x);
res = scanf("%d", &y);
for (int j = 0; j < h; j++) {
res = scanf("%s",sj);
}
while (y-i > 0 && sx-1y-i-1 == '.') {
ans++;
i++;
}
i=1;
while (y+i <= w && sx-1y+i-1 == '.') {
ans++;
i++;
}
i=1;
while (x-i > 0 && sx-i-1y-1 == '.') {
ans++;
i++;
}
i=1;
while (x+i <= h && sx+i-1y-1 == '.') {
ans++;
i++;
}
printf("%d\n",ans);
return 0;
}
私の提出一覧
table: submissions_atcoder_begginer_contest_197_B
提出のURL 提出時刻 結果 備考
1回目 https://atcoder.jp/contests/abc197/submissions/21303846 2021-03-27 21:23:14 AC
感想