結果

問題 No.512 魔法少女の追いかけっこ
ユーザー tnakao0123
提出日時 2017-05-14 21:26:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 922 bytes
コンパイル時間 584 ms
コンパイル使用メモリ 84,248 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 06:25:19
合計ジャッジ時間 1,933 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 53
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:44:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   44 |   scanf("%d%d%d", &x, &y, &n);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:46:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   46 |   for (int i = 0; i < n; i++) scanf("%d", &as[i]);
      |                               ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 512.cc: No.512 魔法少女の追いかけっこ - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 80;
const int INF = 1 << 30;

/* typedef */

/* global variables */

int as[MAX_N + 1];

/* subroutines */

/* main */

int main() {
  int x, y, n;
  scanf("%d%d%d", &x, &y, &n);

  for (int i = 0; i < n; i++) scanf("%d", &as[i]);
  as[n] = INF;

  bool ok = true;
  for (int i = 0; i < n; i++) {
    int b = (as[i] * y + (x - 1)) / x;
    if (b > as[i + 1]) {
      ok = false;
      break;
    }
  }

  if (ok) puts("YES");
  else puts("NO");
  return 0;
}
0