結果
| 問題 | No.3682 きあいのハチマキ |
| コンテスト | |
| ユーザー |
houren
|
| 提出日時 | 2026-09-05 14:55:01 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 19 ms / 2,000 ms |
| + 849µs | |
| コード長 | 1,375 bytes |
| 記録 | |
| コンパイル時間 | 2,070 ms |
| コンパイル使用メモリ | 334,788 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-09-05 14:55:07 |
| 合計ジャッジ時間 | 3,061 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/modint>
using namespace atcoder;
using mint = modint998244353;
using ll = long long;
#define fix(x) fixed << setprecision(x)
#define rep(i, n) for(int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}
constexpr ll INFLL = (1LL << 62), MOD = 998244353;
constexpr int INF = (1 << 30);
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
mint p10 = mint(10).inv(), r = (1-p10*p10);
int t;
cin >> t;
while(t--){
ll a[2],b[2],c[2],t[2];
rep(i,2) cin >> a[i] >> b[i] >> c[i];
rep(i,2) t[i] = (a[i]-1)/b[!i];
mint ans = 0;
if(c[0]<=c[1]){
if(t[0]<=t[1]){
ans += p10.pow(t[1]-t[0]+1)*(1-p10)/r;
}else{
mint p = p10.pow(t[0]-t[1]-1);
ans += (1-p)+p*(1-p10)/r;
}
}
if(c[0]>=c[1]){
if(t[0]<t[1]){
ans += p10.pow(t[1]-t[0])*(1-p10)/r;
}else{
mint p = p10.pow(t[0]-t[1]);
ans += (1-p)+p*(1-p10)/r;
}
}
if(c[0]==c[1]) ans *= 499122177;
cout << ans.val() << '\n';
}
return 0;
}
houren