結果

問題 No.2624 Prediction by Average
ユーザー tnakao0123tnakao0123
提出日時 2024-02-17 00:38:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 739 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 42,048 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-02-17 00:38:50
合計ジャッジ時間 1,053 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
6,548 KB
testcase_04 WA -
testcase_05 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2624.cc:  No.2624 Prediction by Average - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

/* typedef */

typedef long long ll;

/* global variables */

/* subroutines */

/* main */

int main() {
  int tn;
  scanf("%d", &tn);

  while (tn--) {
    ll n;
    int x, y;
    scanf("%lld%d.%d", &n, &x, &y);
    ll s = x * 1000 + y;
    //printf(" n=%lld, s=%lld\n", n, s);
    
    int m = min(999LL, n);
    ll cnt = n - m;
    for (int k = 1; k <= m; k++) {
      ll x0 = (s * k + 999) / 1000;
      ll x1 = (s + 1) * k / 1000;
      //printf("  k=%d, x0=%lld, x1=%lld\n", k, x0, x1);
      if (x0 <= x1) cnt++;
    }

    printf("%lld\n", cnt);
  }

  return 0;
}
0