結果
| 問題 |
No.421 しろくろチョコレート
|
| ユーザー |
tails
|
| 提出日時 | 2016-09-10 00:20:06 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 838 bytes |
| コンパイル時間 | 1,024 ms |
| コンパイル使用メモリ | 22,272 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-16 19:03:48 |
| 合計ジャッジ時間 | 1,797 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 51 WA * 14 |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
1 | a[52][52];
| ^
main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘a’ [-Wimplicit-int]
main.c:2:1: warning: data definition has no type or storage class
2 | s;
| ^
main.c:2:1: warning: type defaults to ‘int’ in declaration of ‘s’ [-Wimplicit-int]
main.c:3:1: warning: data definition has no type or storage class
3 | p[2];
| ^
main.c:3:1: warning: type defaults to ‘int’ in declaration of ‘p’ [-Wimplicit-int]
main.c:5:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
5 | main(m,n,x,y,c,q,t){
| ^~~~
main.c: In function ‘main’:
main.c:5:1: warning: type of ‘m’ defaults to ‘int’ [-Wimplicit-int]
main.c:5:1: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int]
main.c:5:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int]
main.c:5:1: warning: type of ‘y’ defaults to ‘int’ [-Wimplicit-int]
main.c:5:1: warning: type of ‘c’ defaults to ‘int’ [-Wimplicit-int]
main.c:5:1: warning: type of ‘q’ defaults to ‘int’ [-Wimplicit-int]
main.c:5:1: warning: type of ‘t’ defaults to ‘int’ [-Wimplicit-int]
main.c:6:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
6 | scanf("%d%d",&n,&m);
| ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
+++ |+#include <stdio.h>
1 | a[52][52];
main.c:6:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
6 | scanf("%d%d",&n,&m);
| ^~~~~
main.c:6:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:9:34: warning: format ‘%c’ expects argument of type ‘char *’, but argument 2 has type ‘int *’ [-Wformat=]
9 | scanf(" %c",&a[y+1][x+1]);
| ~^
ソースコード
a[52][52];
s;
p[2];
main(m,n,x,y,c,q,t){
scanf("%d%d",&n,&m);
for(y=0;y<n;++y){
for(x=0;x<m;++x){
scanf(" %c",&a[y+1][x+1]);
a[y+1][x+1]>>=6;
}
}
hoge:;
do{
q=0;
for(y=0;y<n;++y){
for(x=0;x<m;++x){
if(a[y+1][x+1]){
c=a[y+0][x+1]+a[y+2][x+1]+a[y+1][x+0]+a[y+1][x+2];
if(c==1){
q=1;s+=100;
a[y+0][x+1]=a[y+2][x+1]=a[y+1][x+0]=a[y+1][x+2]=a[y+1][x+1]=0;
}
}
}
}
}while(q);
for(y=0;y<n;++y){
for(x=0;x<m;++x){
if(a[y+1][x+1]){
if(a[y+1][x+2]){
a[y+1][x+1]=a[y+1][x+2]=0;
s+=100;
goto hoge;
}
if(a[y+2][x+1]){
a[y+1][x+1]=a[y+2][x+1]=0;
s+=100;
goto hoge;
}
}
}
}
for(y=0;y<n;++y){
for(x=0;x<m;++x){
if(a[y+1][x+1]){
p[x+y&1]++;
}
}
}
s+=8*(p[0]<p[1]?p[0]:p[1])+p[0]+p[1];
printf("%d",s);
return 0;
}
tails