結果

問題 No.166 マス埋めゲーム
ユーザー sasa
提出日時 2025-03-06 14:44:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 365 bytes
コンパイル時間 634 ms
コンパイル使用メモリ 27,136 KB
実行使用メモリ 18,752 KB
最終ジャッジ日時 2025-03-06 14:44:45
合計ジャッジ時間 5,236 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample TLE * 1 -- * 1
other -- * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:21: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
   17 |         char *ans = "NO";
      |                     ^~~~
main.cpp:21:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
   21 |                         ans = "YES";
      |                               ^~~~~
main.cpp:23:31: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
   23 |                         ans = "NO";
      |                               ^~~~
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d",&ver);
      |         ~~~~~^~~~~~~~~~~
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d",&hor);
      |         ~~~~~^~~~~~~~~~~
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d",&num);
      |         ~~~~~^~~~~~~~~~~
main.cpp:15:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         scanf("%d",&k);
      |         ~~~~~^~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){
	// 縦マス
	int ver = 0;
	scanf("%d",&ver);
	// 横マス
	int hor = 0;
	scanf("%d",&hor);
	// 人数
	int num = 0;
	scanf("%d",&num);
	// K番目
	int k = 0;
	scanf("%d",&k);
	
	char *ans = "NO";
	int i = 1;
	while(i != (ver * hor) + 1){
		if(i % num == k){
			ans = "YES";
		}else{
			ans = "NO";
		}
	}
	printf("%s",ans);
}
0