結果

問題 No.640 76本のトロンボーン
コンテスト
ユーザー 👑 tails
提出日時 2018-01-26 22:57:58
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,431 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 191 ms
コンパイル使用メモリ 32,980 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-08 16:15:46
合計ジャッジ時間 878 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | n;r;
      | ^
main.c:1:3: warning: data definition has no type or storage class
    1 | n;r;
      |   ^
main.c: In function ‘main’:
main.c:61:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
   61 |         scanf("%d ",&n);
      |         ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | n;r;
main.c:117:9: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
  117 |         printf("%d",r);
      |         ^~~~~~
main.c:117:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
/usr/bin/ld: /tmp/ccSdApB3.o: in function `main':
main.c:(.text.startup+0x4d): 警告: the `gets' function is dangerous and should not be used.

ソースコード

diff #
raw source code

n;r;
char s[99][99];
char t[99][99];

f(x,y,a){
	for(x=0;x<n-1;++x){
		if(t[0][x]=='#'){
			return;
		}
	}
	a=1;
	for(x=0;x<n-1;++x){
		for(y=1;y<n;++y){
			if(t[y][x]=='#'){
				goto dame1;
			}
		}
		++a;
		dame1:;
	}
	if(t[0][n-1]!='#'||t[n-1][n-1]!='#'){
		for(y=1;y<n-1;++y){
			if(t[y][n-1]=='#'){
				goto dame2;
			}
		}
		++a;
		dame2:;
	}
	if(r<a) r=a;
}

g(x,y,a){
	a=0;
	for(x=0;x<n;++x){
		if(t[0][x]=='#'&&t[n-1][x]=='#'){
			goto dame;
		}
		for(y=1;y<n-1;++y){
			if(t[y][x]=='#'){
				goto dame;
			}
		}
		++a;
		dame:;
	}
	if(r<a) r=a;
}

h(i){
	for(i=0;i<n;++i){
		if(t[0][i]=='#') return;
		if(t[n-1][i]=='#') return;
		if(t[i][0]=='#') return;
		if(t[i][n-1]=='#') return;
	}
	if(r<4) r=4;
}

main(x,y){
	scanf("%d ",&n);
	for(y=0;y<n;++y){
		gets(s[y]);
	}
	for(y=0;y<n;++y){
		for(x=0;x<n;++x){
			t[y][x]=s[y][x];
		}
	}
	h();
	g();
	f();
	for(y=0;y<n;++y){
		for(x=0;x<n;++x){
			t[y][x]=s[y][n-1-x];
		}
	}
	h();
	f();
	for(y=0;y<n;++y){
		for(x=0;x<n;++x){
			t[y][x]=s[n-1-y][x];
		}
	}
	f();
	for(y=0;y<n;++y){
		for(x=0;x<n;++x){
			t[y][x]=s[n-1-y][n-1-x];
		}
	}
	f();
	for(y=0;y<n;++y){
		for(x=0;x<n;++x){
			t[y][x]=s[x][y];
		}
	}
	g();
	f();
	for(y=0;y<n;++y){
		for(x=0;x<n;++x){
			t[y][x]=s[x][n-1-y];
		}
	}
	f();
	for(y=0;y<n;++y){
		for(x=0;x<n;++x){
			t[y][x]=s[n-1-x][y];
		}
	}
	f();
	for(y=0;y<n;++y){
		for(x=0;x<n;++x){
			t[y][x]=s[n-1-x][n-1-y];
		}
	}
	f();
	printf("%d",r);
}
0