結果
| 問題 | 
                            No.82 市松模様
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-02-04 14:34:03 | 
| 言語 | C90  (gcc 12.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1 ms / 5,000 ms | 
| コード長 | 268 bytes | 
| コンパイル時間 | 84 ms | 
| コンパイル使用メモリ | 19,840 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-09-21 20:30:35 | 
| 合計ジャッジ時間 | 573 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 7 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:5: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    4 |     scanf("%d%d%c%c",&w,&h,&c,&c);
      |     ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | int main(){
main.c:4:5: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    4 |     scanf("%d%d%c%c",&w,&h,&c,&c);
      |     ^~~~~
main.c:4:5: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:8:13: warning: implicit declaration of function ‘putchar’ [-Wimplicit-function-declaration]
    8 |             putchar(str[f=!f]);
      |             ^~~~~~~
main.c:8:13: note: include ‘<stdio.h>’ or provide a declaration of ‘putchar’
            
            ソースコード
int main(){
    char str[]={'B','W'};
    int w,h,x,y;int f;char c;
    scanf("%d%d%c%c",&w,&h,&c,&c);
    f=c=='B';
    for (y=0;y<h;y++){
        for (x=0;x<w;x++)
            putchar(str[f=!f]);
        if (!(w%2)) f=!f;
        putchar('\n');
    }
    return 0;
}