結果
問題 |
No.2624 Prediction by Average
|
ユーザー |
![]() |
提出日時 | 2024-02-09 21:50:35 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 540 bytes |
コンパイル時間 | 3,006 ms |
コンパイル使用メモリ | 245,124 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-28 15:05:25 |
合計ジャッジ時間 | 3,002 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; ll N; int S; void solve(){ cin >> N; { string s; cin >> s; s.erase(s.find('.'), 1); S = stoi(s); } ll X = N - min(N, 1000ll); N = min(N, 1000ll); ll ans = 0; for(int i = 1;i <= N;i++){ ans += ((S + 1) * i - 1) / 1000 - (S * i - 1) / 1000; } cout << ans + X << endl; } int main(void){ ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while(t--)solve(); return 0; }