結果
| 問題 |
No.2734 Addition and Multiplication in yukicoder (Hard)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-20 00:04:39 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 874 bytes |
| コンパイル時間 | 2,602 ms |
| コンパイル使用メモリ | 206,884 KB |
| 最終ジャッジ日時 | 2025-02-21 05:52:32 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 WA * 5 |
ソースコード
#include <bits/stdc++.h>
#define INF 1000000001LL
#define LNF 1000000000000000001LL
#define MOD 998244353LL
#define MAX 1005
#define long long long
#define all(x) x.begin(),x.end()
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<pair<string,long>> arr;
for(int i = 0; i<n; i++)
{
long x;
cin >> x;
string s;
string strX = to_string(x);
for(int j = 0; j < 20; j++)
s.push_back(strX[j%strX.size()]);
arr.push_back({s,x});
}
sort(all(arr));
long res = 0;
for(int i = 0; i<n; i++)
{
long x = arr[i].second;
while(x)
{
res*=10;
res%=MOD;
x/=10;
}
res+=arr[i].second;
res%=MOD;
}
cout << res << endl;
return 0;
}