結果

問題 No.2624 Prediction by Average
ユーザー Carpenters-Cat
提出日時 2024-02-10 20:26:55
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 414 bytes
コンパイル時間 1,947 ms
コンパイル使用メモリ 192,580 KB
最終ジャッジ日時 2025-02-19 04:42:08
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
	ll N; string s;
	cin >> N >> s;
	ll a = stoll(s.substr(s.size() - 3, 3));
	ll ans = max(0ll, N - 999);
	for (ll i = 1; i < min(1000ll, N + 1); i ++) {
		ll l = i * a, r = i * a + i;
		ll b = ((l + 999) / 1000) * 1000;
		if (b < r) {
			ans ++;
		}
	}
	cout << ans << endl;
}
int main () {
	int t;
	cin >> t;
	while(t--) solve();
}
0