結果

問題 No.512 魔法少女の追いかけっこ
ユーザー taba
提出日時 2017-05-17 22:19:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 388 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 47,104 KB
最終ジャッジ日時 2025-01-05 00:18:55
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 48 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d%d%d",&x,&y,&n);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~
main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%lf",&a[i]);
      |                 ~~~~~^~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <vector>

using namespace std;
int main(){
	int x,y,n;
	scanf("%d%d%d",&x,&y,&n);
	vector<double> a(n);
	for(int i=0;i<n;i++)
		scanf("%lf",&a[i]);
	
	bool tf=true;
	for(int i=0;i<n-1;i++){
		double time=a[i]/x;
		double ypos=y*time;
		//printf("time=%lf pos=%lf\n",time,ypos);
		if(ypos>a[i+1]){
			tf=false;
			break;
		}
	}
	puts(tf?"YES":"NO");
	return 0;
}
0