結果

問題 No.228 ゆきこちゃんの 15 パズル
ユーザー ciel
提出日時 2015-06-19 22:32:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 290 bytes
コンパイル時間 108 ms
コンパイル使用メモリ 23,680 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-07 04:05:57
合計ジャッジ時間 664 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |                 scanf("%d",a+y*4+x);
      |                 ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
using namespace std;

int a[16];
int main(){
	for(int y=0;y<4;y++)for(int x=0;x<4;x++){
		scanf("%d",a+y*4+x);
		int k=a[y*4+x];
		if(k){
			k--;
			int tx=k%4,ty=k/4;
			int d=abs(y-ty)+abs(x-tx);
			if(d>1){puts("No");return 0;}
		}
	}
	puts("Yes");
}
0