結果

問題 No.1343 Dividing Digit
ユーザー tarattata1tarattata1
提出日時 2021-01-16 14:15:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,221 bytes
コンパイル時間 677 ms
コンパイル使用メモリ 90,712 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-05 16:31:37
合計ジャッジ時間 4,800 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#include <ctime>
#pragma warning(disable:4996) 

//#define ATCODER
#ifdef ATCODER
#include <atcoder/all>
#endif

typedef long long ll;
typedef unsigned long long ull;
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define LINF3 1000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
const long long MOD = 998244353;

using namespace std;
#ifdef ATCODER
using namespace atcoder;
#endif


void solve()
{
    int n, K;
    scanf("%d%d", &n, &K);
    vector<ll> a(K);
    int i;
    ll s = 0;
    for (i = 0; i < n; i++) {
        scanf("%lld", &a[i]);
        s += a[i];
    }
    ll ans = 0;
    for (i = 0; i < n; i++) {
        ans = (ans*K + a[i]) % s;
    }
    printf("%lld\n", ans);

    return;
}

int main()
{
#if 1
    solve();
#else
    int T, t;
    cin >> T;
    for (t = 0; t < T; t++) {
        //cout << "Case #" << t + 1 << ": ";
        solve();
    }
#endif
    return 0;
}
0