結果
問題 | No.2046 Ans Mod? Mod Ans! |
ユーザー |
|
提出日時 | 2021-07-19 14:54:41 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 451 bytes |
コンパイル時間 | 5,612 ms |
コンパイル使用メモリ | 163,952 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-12-16 08:10:00 |
合計ジャッジ時間 | 43,980 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 TLE * 8 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> a(n, 0); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); ll ans = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { ans += a[i] - a[j] % a[i]; } } cout << ans << endl; }