結果
| 問題 |
No.2235 Line Up Colored Balls
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-04 10:05:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 2,000 ms |
| コード長 | 461 bytes |
| コンパイル時間 | 4,353 ms |
| コンパイル使用メモリ | 251,936 KB |
| 最終ジャッジ日時 | 2025-02-11 05:07:05 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 55 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
using mint = modint1000000007;
int n;
vector<int> x;
void solve(){
ll s = 0;
for(auto &i:x)s+=i;
mint ans = 0;
for(int i = 0;i<n;i++){
ans += mint(s-x[i])*mint(x[i])/s;
}
ans++;
cout<<ans.val()<<endl;
}
signed main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
cin >> n;
x = vector<int>(n);
for(auto &i:x)cin >> i;
solve();
}