結果
| 問題 | No.1233 割り切れない気持ち |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-05-02 12:06:29 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1,185 ms / 3,153 ms |
| コード長 | 589 bytes |
| 記録 | |
| コンパイル時間 | 1,283 ms |
| コンパイル使用メモリ | 209,260 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-07-04 16:08:27 |
| 合計ジャッジ時間 | 12,679 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 39 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAXN = 200001;
int n, a[MAXN];
ll ans, sum[MAXN], res;
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n;
for(int i = 1; i <= n; ++i) {
cin >> a[i];
sum[a[i]] += a[i], res += a[i];
}
for(int i = 1; i < MAXN; ++i) {
sum[i] += sum[i - 1];
}
for(int i = 1; i <= n; ++i) {
ans += res;
for(int l = 1, r = 1; l <= a[i]; l = r + 1) {
r = a[i] / (a[i] / l);
ans -= 1ll * (a[i] / l) * (sum[r] - sum[l - 1]);
}
}
cout << ans;
return 0;
}
vjudge1