結果

問題 No.2729 Addition and Multiplication in yukicoder (Easy)
ユーザー tentententen
提出日時 2024-04-22 09:48:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 385 ms / 2,000 ms
コード長 1,432 bytes
コンパイル時間 3,581 ms
コンパイル使用メモリ 79,128 KB
実行使用メモリ 56,224 KB
最終ジャッジ日時 2024-04-22 09:49:12
合計ジャッジ時間 9,431 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
37,108 KB
testcase_01 AC 47 ms
36,980 KB
testcase_02 AC 335 ms
55,736 KB
testcase_03 AC 311 ms
50,384 KB
testcase_04 AC 319 ms
50,636 KB
testcase_05 AC 333 ms
50,908 KB
testcase_06 AC 371 ms
55,860 KB
testcase_07 AC 342 ms
53,956 KB
testcase_08 AC 294 ms
56,224 KB
testcase_09 AC 47 ms
36,988 KB
testcase_10 AC 48 ms
37,056 KB
testcase_11 AC 47 ms
37,184 KB
testcase_12 AC 385 ms
56,044 KB
testcase_13 AC 361 ms
56,124 KB
testcase_14 AC 368 ms
55,812 KB
testcase_15 AC 385 ms
56,084 KB
testcase_16 AC 316 ms
54,488 KB
testcase_17 AC 313 ms
54,164 KB
testcase_18 AC 340 ms
54,716 KB
testcase_19 AC 337 ms
54,196 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

public class Main {
    static final int MOD = 998244353;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        long[] values = new long[n];
        for (int i = 0; i < n; i++) {
            values[i] = sc.nextLong();
        }
        Arrays.sort(values);
        long ans = 0;
        for (long x : values) {
            ans = (ans * 10 + x) % MOD;
        }
        System.out.println(ans);
    }
}
class Scanner {
    BufferedReader br;
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
        } catch (Exception e) {
            
        }
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    
    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    
    public String next() {
        try {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            return st.nextToken();
        }
    }
    
}
0