結果
| 問題 | No.2734 Addition and Multiplication in yukicoder (Hard) |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2024-04-30 18:31:21 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 309 ms / 5,000 ms |
| コード長 | 804 bytes |
| 記録 | |
| コンパイル時間 | 834 ms |
| コンパイル使用メモリ | 83,760 KB |
| 実行使用メモリ | 16,512 KB |
| 最終ジャッジ日時 | 2026-07-04 15:57:41 |
| 合計ジャッジ時間 | 8,708 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 2734.cc: No.2734 Addition and Multiplication in yukicoder (Hard) - yukicoder
*/
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_N = 200000;
const int MAX_L = 20;
const int MOD = 998244353;
/* typedef */
typedef long long ll;
/* global variables */
string as[MAX_N];
/* subroutines */
bool cmpstr(const string &a, const string &b) {
return (a + b) < (b + a);
}
/* main */
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
char s[MAX_L + 4];
scanf("%s", s);
as[i] = string(s);
}
sort(as, as + n, cmpstr);
int sum = 0;
for (int i = 0; i < n; i++)
for (auto c: as[i])
sum = ((ll)sum * 10 + (c - '0')) % MOD;
printf("%d\n", sum);
return 0;
}
tnakao0123