結果

問題 No.2046 Ans Mod? Mod Ans!
ユーザー 👑 箱星箱星
提出日時 2021-07-18 22:06:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 433 bytes
コンパイル時間 1,976 ms
コンパイル使用メモリ 201,656 KB
実行使用メモリ 10,528 KB
最終ジャッジ日時 2024-05-09 17:16:33
合計ジャッジ時間 8,144 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 5 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 5 ms
5,376 KB
testcase_06 AC 4 ms
5,376 KB
testcase_07 AC 4 ms
5,376 KB
testcase_08 AC 44 ms
5,376 KB
testcase_09 AC 60 ms
5,376 KB
testcase_10 AC 77 ms
5,376 KB
testcase_11 AC 151 ms
5,376 KB
testcase_12 AC 102 ms
5,376 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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];
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            ans += abs(a[i] % a[j] - a[j] % a[i]);
        }
    }
    cout << ans << endl;
}
0