結果

問題 No.166 マス埋めゲーム
ユーザー furafy
提出日時 2015-04-18 22:13:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 397 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 40,832 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-04 16:25:59
合計ジャッジ時間 977 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘double’ [-Wformat=]
   16 |         printf("%d\n", size);
      |                 ~^     ~~~~
      |                  |     |
      |                  int   double
      |                 %f
main.cpp:10:15: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         fscanf(stdin, "%f %f %f %f", &H, &W, &N, &K);
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cmath>
#include <vector>
using namespace std;

int main(){
	using std::vector;
	float H, W, N, K;
	float size;
	fscanf(stdin, "%f %f %f %f", &H, &W, &N, &K);
	size = H * W;
	if (size > N) {
		size = fmod(size, N);
	}
	//vector<vector<int>> arr(H, vector<int>(W));
	printf("%d\n", size);
	if (size == K) {
		printf("YES\n");
	}
	else {
		printf("NO\n");
	}
	return 0;
}
0