結果
問題 | No.2742 Car Flow |
ユーザー |
|
提出日時 | 2024-04-17 22:53:47 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 36 ms / 2,000 ms |
コード長 | 500 bytes |
コンパイル時間 | 1,868 ms |
コンパイル使用メモリ | 192,328 KB |
最終ジャッジ日時 | 2025-02-21 02:51:49 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 50 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; ll mod = 998244353; ll mod_pow(ll a, ll n){ ll res = 1; while(n > 0){ if(n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } ll mod_inv(ll a){ return mod_pow(a, mod - 2); } int main(){ int n; cin >> n; int r = 0; for(int i = 0; i < n; i++){ int a; cin >> a; r += a; } cout << min(r, n - r) * mod_inv(n) % mod << endl; }