結果
| 問題 |
No.2624 Prediction by Average
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2024-02-17 00:42:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 745 bytes |
| コンパイル時間 | 324 ms |
| コンパイル使用メモリ | 42,112 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-09-28 23:16:31 |
| 合計ジャッジ時間 | 839 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 |
ソースコード
/* -*- 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 - 1) / 1000;
//printf(" k=%d, x0=%lld, x1=%lld\n", k, x0, x1);
if (x0 <= x1) cnt++;
}
printf("%lld\n", cnt);
}
return 0;
}
tnakao0123