結果
問題 | No.2624 Prediction by Average |
ユーザー |
|
提出日時 | 2024-02-09 21:53:17 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 969 bytes |
コンパイル時間 | 2,353 ms |
コンパイル使用メモリ | 248,280 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-28 15:09:10 |
合計ジャッジ時間 | 2,722 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 4 |
ソースコード
// #pragma GCC optimize("O3,unroll-loops")#include <bits/stdc++.h>// #include <x86intrin.h>using namespace std;#if __cplusplus >= 202002Lusing namespace numbers;#endifint main(){cin.tie(0)->sync_with_stdio(0);cin.exceptions(ios::badbit | ios::failbit);auto __solve_tc = [&](auto __tc_num)->int{long long th;string s;cin >> th >> s;erase(s, '.');int avg = stoi(s) % 1000;long long res = 0;{ // 0int req = 1000 / gcd(avg, 1000);res += th / req;}if(gcd(avg, 1000) == 1){ // 999int inv = 1;{int base = avg;for(auto e = 399; e; e >>= 1){if(e & 1){inv = inv * base % 1000;}base = base * base % 1000;}}int rem = 999 * inv % 1000;if(th >= rem){res += 1 + (th - rem) / 1000;}}cout << res << "\n";return 0;};int __tc_cnt;cin >> __tc_cnt;for(auto __tc_num = 0; __tc_num < __tc_cnt; ++ __tc_num){__solve_tc(__tc_num);}return 0;}/**/