結果

問題 No.2734 Addition and Multiplication in yukicoder (Hard)
ユーザー srjywrdnprkt
提出日時 2024-04-25 15:07:15
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 663 ms / 5,000 ms
コード長 602 bytes
コンパイル時間 2,172 ms
コンパイル使用メモリ 207,140 KB
最終ジャッジ日時 2025-02-21 08:56:53
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    ll N, ans=0;
    cin >> N;
    string S, T="";
    vector<string> v;

    for (int i=0; i<N; i++){
        cin >> S;
        v.push_back(S);
    }

    const ll modc = 998244353;

    auto key=[](string a, string b)->bool{
        return a+b < b+a;
    };
    sort(v.begin(), v.end(), key);

    for (auto &x : v) T += x;
    for (auto x : T){
        ans *= 10;
        ans += x-'0';
        ans %= modc;
    }

    cout << ans << endl;

    return 0;
}
0