結果

問題 No.512 魔法少女の追いかけっこ
ユーザー _massibu_massibu
提出日時 2017-05-08 23:36:28
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 1,566 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 28,704 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 13:25:59
合計ジャッジ時間 1,878 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 WA -
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 0 ms
4,376 KB
testcase_13 AC 0 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 0 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 0 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 0 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 WA -
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 0 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 0 ms
4,380 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 0 ms
4,376 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 0 ms
4,380 KB
testcase_36 AC 0 ms
4,380 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 0 ms
4,380 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 0 ms
4,376 KB
testcase_41 AC 0 ms
4,380 KB
testcase_42 AC 1 ms
4,376 KB
testcase_43 AC 1 ms
4,376 KB
testcase_44 AC 0 ms
4,380 KB
testcase_45 AC 0 ms
4,380 KB
testcase_46 AC 1 ms
4,380 KB
testcase_47 WA -
testcase_48 AC 0 ms
4,376 KB
testcase_49 AC 1 ms
4,380 KB
testcase_50 AC 0 ms
4,376 KB
testcase_51 AC 1 ms
4,380 KB
testcase_52 AC 0 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "stdio.h"

int main()
{
	//変数を宣言し、配列はforで初期化する。
	//役割は、順番に「koboの速度」「師匠の速度」「交差点の数」「交差点の位置」。
	//問題では到達の可否を調べているのであって、何秒かかるとかはどうでもいいので、
	//簡単化のために単位のことは忘れることにする。
	int X = 0, Y = 0, N = 0;
	long A[90];
	for (int i = 0; i < 90; i++) {
		A[i] = 0;
	}

	//scanfで変数の値を入力。
	//AはforをN回やってとる
	scanf("%d %d",&X,&Y);
	scanf("%d",&N);
	for (int i = 0; i < N; i++) {
		scanf("%ld", &A[i]);
	}

	//koboがそれぞれの交差点に達したときの、師匠のいる位置を見て答えを出すことにする。

	//Xがどこの交差点にいるかを変数にしておく。
	int Xpoint = 0;
	//XがXpointの交差点にたどりつくための時間を計算する、ための変数。
	//これは小数になりうるのでdouble型。
	double time = 0.0;

	while (1) {
		time = ((double)A[Xpoint] / (double)X);

		//XがN(添え字ではN-1)の交差点にたどりつければ、Xは最後までYを追いかけられたことになる。
		if (Xpoint == N - 1) {
			printf("YES\n");
			break;
		}

		//もしXがXpointの交差点にたどりついた時点で、Yがその次の交差点の位置より先にいるなら、
		//Xは最後までYを追いかけられない。
		if ( (double)(Y * time) > (double)(A[Xpoint + 1]) ) {
			printf("NO\n");
			break;
		}

		Xpoint++;
	}
	

    return 0;
}
0