結果

問題 No.402 最も海から遠い場所
ユーザー TawaraTawara
提出日時 2016-07-22 00:28:32
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 1,239 ms
コンパイル使用メモリ 54,784 KB
実行使用メモリ 14,720 KB
最終ジャッジ日時 2024-04-24 05:21:44
合計ジャッジ時間 3,431 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:52: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wformat=]
   26 |                         fprintf(stderr,"%dth size:%d!=W:%d.\n",i,S[i].size(),W);
      |                                                   ~^             ~~~~~~~~~~~
      |                                                    |                      |
      |                                                    int                    std::__cxx11::basic_string<char>::size_type {aka long unsigned int}
      |                                                   %ld
main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         scanf("%d %d",&H,&W);
      |         ~~~~~^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

#define range(i,a,b) for(int i=(a); i < (b); i++)
#define rep(i,n) range(i,0,n)

string S[3000];
int HD[3002][3002],VD[3002][3002];
int main(){
	int H,W,ans = 0;
	scanf("%d %d",&H,&W);
	if ((H < 1)||(H > 3000)){
		fprintf(stderr,"H is bad!\n");
		return -1;
	}
	if ((W < 1)||(W > 3000)){
		fprintf(stderr,"W is bad!\n");
		return -1;
	}
	rep(i,H){
		cin >> S[i];
		if (S[i].size() != W){
			fprintf(stderr,"%dth size:%d!=W:%d.\n",i,S[i].size(),W);
		}
		rep(j,W){
			if ((S[i][j] != '#') && (S[i][j] != '.')){
				fprintf(stderr,"(%d,%d):%c is wrong.\n",i,j,S[i][j]);
			}
		}
	}
	return 0;
}
0