結果
問題 | No.2624 Prediction by Average |
ユーザー |
|
提出日時 | 2024-02-09 22:33:17 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 791 bytes |
コンパイル時間 | 2,125 ms |
コンパイル使用メモリ | 207,820 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-28 15:45:55 |
合計ジャッジ時間 | 2,511 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 5 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;vector<vector<bool>> S(1000, vector<bool>(1000, false));void solve() {ll n;string t;cin >> n >> t;int m = 0, b = 1;for (int k = 0; k < 3; k++) {m += b * (int)(t[(int)t.size()-1-k] - '0');b *= 10;}ll ans = 0;for (int i = 1; i <= min(n, 999LL); i++) {ans += S[i][m];}if (n >= 1000) ans += n - 999;cout << ans << "\n";}int main() {for (int i = 1; i <= 999; i++) {for (int j = 0; j < i; j++) {int x = (j * 1000) / i;S[i][x] = true;}}ios::sync_with_stdio(false);cin.tie(nullptr);cout << fixed << setprecision(15);int T = 1;cin >> T;while (T--) solve();}