結果
問題 |
No.2734 Addition and Multiplication in yukicoder (Hard)
|
ユーザー |
|
提出日時 | 2024-04-19 22:16:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 642 bytes |
コンパイル時間 | 2,273 ms |
コンパイル使用メモリ | 199,716 KB |
最終ジャッジ日時 | 2025-02-21 04:29:20 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 WA * 35 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:15:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%lld", &x); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> typedef long long LL; typedef __int128 LLL; #define FOR(i, ed) for(int i = 0; i <= ed; ++i) const int N = 10; const int MOD = 998244353; int n; int main() { scanf("%d", &n); std::vector<std::pair<LL, LLL>> a(n); for(auto &[x, y]: a) { scanf("%lld", &x); LL t = x; y = 1; while(t) { t /= 10; y *= 10; } } std::sort(a.begin(), a.end(), [] (const auto &s, const auto &t) { auto &&[x, y] = s; auto &&[p, q] = t; return x * q < y * p;}); int ans = 0; for(auto &&[x, y]: a) ans = (ans * y + x) % MOD; printf("%d\n", ans); return 0; }