結果

問題 No.467 隠されていたゲーム
ユーザー fura
提出日時 2020-06-05 18:03:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 2,143 ms
コンパイル使用メモリ 193,500 KB
最終ジャッジ日時 2025-01-10 21:38:01
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         int n; scanf("%d",&n);
      |                ~~~~~^~~~~~~~~
main.cpp:10:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         rep(i,n) scanf("%d",&d[i]);
      |                  ~~~~~^~~~~~~~~~~~
main.cpp:11:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         int x,y; scanf("%d%d",&x,&y);
      |                  ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

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

using namespace std;

int main(){
	int n; scanf("%d",&n);
	vector<int> d(n);
	rep(i,n) scanf("%d",&d[i]);
	int x,y; scanf("%d%d",&x,&y);

	int g=max(abs(x),abs(y));
	if(g==0) return puts("0"),0;
	rep(i,n) if(d[i]==g) return puts("1"),0;

	int mx=*max_element(d.begin(),d.end());
	printf("%d\n",max((g+mx-1)/mx,2));

	return 0;
}
0