結果
問題 | No.179 塗り分け |
ユーザー |
![]() |
提出日時 | 2016-06-16 01:14:27 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,047 bytes |
コンパイル時間 | 350 ms |
コンパイル使用メモリ | 22,144 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-03 03:26:09 |
合計ジャッジ時間 | 1,500 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 6 |
other | WA * 40 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:39:27: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[50]’ [-Wformat=] 39 | for(i=0;i<H;i++)scanf("%s",&s[i]); | ~^ ~~~~~ | | | | | char (*)[50] | char * main.c:38:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 38 | scanf("%d %d",&H,&W); | ^~~~~~~~~~~~~~~~~~~~ main.c:39:19: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 39 | for(i=0;i<H;i++)scanf("%s",&s[i]); | ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int H,W; char s[50][50]; char tmp[50][50]; int color(int di,int dj){ int i,j; for(i=0;i<H;i++){ for(j=0;j<W;j++){ if(tmp[i][j]=='#'){ if(tmp[i+di][j+dj]=='#' && i+di<=H && j+dj<=W)tmp[i][j]=tmp[i+di][j+dj]='.'; else return 0; } } } return 1; } void init(){ int i,j; for(i=0;i<H;i++){ for(j=0;j<W;j++){ tmp[i][j]=s[i][j]; } } } void print(){ int i,j; for(i=0;i<H;i++){ for(j=0;j<W;j++){ printf("%c",tmp[i][j]); } printf("\n"); } } int main(){ int i,j; int di,dj; scanf("%d %d",&H,&W); for(i=0;i<H;i++)scanf("%s",&s[i]); init(); di=0; for(dj=1;dj<W;dj++){ // printf("%d %d\n",di,dj); if(color(di,dj)==1){ printf("Yes\n"); //print(); return 0; } //print(); init(); } for(di=1;di<H;di++){ for(dj=-W+1;dj<W;dj++){ //printf("%d %d\n",di,dj); if(color(di,dj)==1){ printf("Yes\n"); //print(); return 0; } // print(); init(); } } printf("No\n"); return 0; }