結果

問題 No.3261 yiwiy9 → yiwiY9
ユーザー tnakao0123
提出日時 2025-09-07 16:38:32
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 604 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 40,940 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-07 16:38:34
合計ジャッジ時間 1,729 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:27:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   27 |   scanf("%d%d", &h, &w);
      |   ~~~~~^~~~~~~~~~~~~~~~
main.cpp:30:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |     scanf("%s", s);
      |     ~~~~~^~~~~~~~~

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 3261.cc:  No.3261 yiwiy9 竊・yiwiY9 - yukicoder
 */

#include<cstdio>
#include<algorithm>

using namespace std;

/* constant */

const int MAX_W = 200;

/* typedef */

/* global variables */

char s[MAX_W + 4];

/* subroutines */

/* main */

int main() {
  int h, w;
  scanf("%d%d", &h, &w);

  for (int i = 0; i < h; i++) {
    scanf("%s", s);

    for (int j = 0; j < w;) {
      if (s[j] == 'y') { // right
	s[j + 4] = 'Y', j += 6;
      }
      else if (s[j] == '9') { // left
	s[j + 1] = 'Y', j += 6;
      }
      else
	j++;
    }

    puts(s);
  }

  return 0;
}
0