結果
| 問題 |
No.2734 Addition and Multiplication in yukicoder (Hard)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-03 17:58:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 882 ms / 5,000 ms |
| コード長 | 568 bytes |
| コンパイル時間 | 4,600 ms |
| コンパイル使用メモリ | 260,416 KB |
| 最終ジャッジ日時 | 2025-02-21 10:47:27 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
using mll = modint998244353;
ll n;
vector<string> a;
void solve(){
sort(a.begin(),a.end(),[](string x,string y){
return x+y < y+x;
});
string ans;
for(int i = 0;i<n;i++) ans += a[i];
mll res = 0;
for(int i = 0;i<ans.size();i++){
res = res * 10 + (ans[i]-'0');
}
cout<<res.val()<<endl;
}
signed main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
cin >> n;
a = vector<string>(n);
for(ll i = 0; i < n; ++i) cin >> a[i];
solve();
}