結果

問題 No.2728 Grid Expansion
ユーザー Maeda
提出日時 2025-03-28 09:15:54
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 26,368 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-28 09:15:55
合計ジャッジ時間 1,467 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d",&n);
      |     ^~~~~~~~~~~~~~
main.c:7:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d",&k);
      |     ^~~~~~~~~~~~~~
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%s",pattern[i]);
      |         ^~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>

void main(void){
    int n,k;
    scanf("%d",&n);
    scanf("%d",&k);
    char pattern[n*k][20] = {};
    for(int i = 0 ; i < n*k ; i+=k){
        scanf("%s",pattern[i]);
        for(int j = 1;j < k ; j++){
            strcpy(pattern[i+j],pattern[i]);
        }
    }
    for(int i = 0 ; i < n*k ; i++){
        for(int j = 0 ; j < n ; j++ ){
            int count = 0;
            while(count < k){
                printf("%c",pattern[i][j]);
                count++;
            }
        }
        printf("\n");
    }
}
0