結果
問題 |
No.2734 Addition and Multiplication in yukicoder (Hard)
|
ユーザー |
![]() |
提出日時 | 2024-04-19 22:33:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 591 bytes |
コンパイル時間 | 2,581 ms |
コンパイル使用メモリ | 210,676 KB |
最終ジャッジ日時 | 2025-02-21 04:45:04 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 WA * 35 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> using namespace std; using namespace atcoder; using mint=modint998244353; int main(){ int n;cin>>n; vector<long long> a(n); for(int i=0;i<n;i++)cin>>a[i]; vector<pair<string,long long>> srt(n); for(int i=0;i<n;i++){ srt[i]={to_string(a[i]),a[i]}; } sort(srt.begin(),srt.end()); mint ans=0; vector<mint> pw(20); pw[0]=1; for(int i=0;i<19;i++)pw[i+1]=pw[i]*10; for(int i=0;i<n;i++){ ans*=pw[srt[i].first.length()]; ans+=srt[i].second; } cout<<ans.val()<<"\n"; }