結果

問題 No.1299 Random Array Score
ユーザー yoshykaiyoshykai
提出日時 2020-11-27 21:53:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 274 ms / 2,000 ms
コード長 2,777 bytes
コンパイル時間 3,622 ms
コンパイル使用メモリ 79,492 KB
実行使用メモリ 57,148 KB
最終ジャッジ日時 2023-10-01 05:28:01
合計ジャッジ時間 12,365 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
49,824 KB
testcase_01 AC 48 ms
50,044 KB
testcase_02 AC 49 ms
49,396 KB
testcase_03 AC 254 ms
57,100 KB
testcase_04 AC 244 ms
56,724 KB
testcase_05 AC 220 ms
56,752 KB
testcase_06 AC 226 ms
56,804 KB
testcase_07 AC 231 ms
56,988 KB
testcase_08 AC 246 ms
56,680 KB
testcase_09 AC 108 ms
52,936 KB
testcase_10 AC 190 ms
55,672 KB
testcase_11 AC 137 ms
55,400 KB
testcase_12 AC 225 ms
56,908 KB
testcase_13 AC 274 ms
56,484 KB
testcase_14 AC 222 ms
56,320 KB
testcase_15 AC 231 ms
56,884 KB
testcase_16 AC 230 ms
56,344 KB
testcase_17 AC 141 ms
55,452 KB
testcase_18 AC 201 ms
56,016 KB
testcase_19 AC 202 ms
56,272 KB
testcase_20 AC 165 ms
55,260 KB
testcase_21 AC 104 ms
52,784 KB
testcase_22 AC 147 ms
55,468 KB
testcase_23 AC 220 ms
56,828 KB
testcase_24 AC 228 ms
56,572 KB
testcase_25 AC 226 ms
56,748 KB
testcase_26 AC 97 ms
52,300 KB
testcase_27 AC 145 ms
55,432 KB
testcase_28 AC 141 ms
55,664 KB
testcase_29 AC 157 ms
55,396 KB
testcase_30 AC 230 ms
56,760 KB
testcase_31 AC 160 ms
55,260 KB
testcase_32 AC 251 ms
57,148 KB
testcase_33 AC 258 ms
55,212 KB
testcase_34 AC 171 ms
55,344 KB
testcase_35 AC 271 ms
56,972 KB
testcase_36 AC 174 ms
53,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
class Main{
  public static void main(String args[]){
    int n = readI();
    long k = readLong(),s=0;
    long mod = 998244353;
    for(int i=0;i<n;i++){
      s+=readI();
      s%=mod;
    }
    long z = modpow(2,k,mod);
    z=(z*s)%mod;
    pl(z+"");
  }

  public static long modpow(long x,long n,long mod){
    long r = 1;
    while(n>=1){
      if(1==(n&1)){
        r = r*x % mod;
      }
      x = x*x % mod;
      n/=2;
    }
    return r;
  }

  public static void sortA(int n[]){
    Arrays.sort(n);
  }

  static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
  public static String read(){
    try{
      return ctos((char)br.read());
    }catch(IOException e){
      e.printStackTrace();
      return "";
    }
  }
  public static char readC(){
    try{
      return (char)br.read();
    }catch(IOException e){
      e.printStackTrace();
      return (char)-1;
    }
  }
  public static String readL(){
    try{
      return br.readLine();
    }catch(IOException e){
      e.printStackTrace();
      return "";
    }
  }
  public static String readS(){
    StringBuilder sb = new StringBuilder();
    while(true){
      try{
        int k = br.read();
        if(k==-1||(char)k==' '||(char)k=='\n'){break;}
        sb.append((char)k);
      }catch(IOException e){
        e.printStackTrace();
      }
    }
    return sb.toString();
  }
  public static long readLong(){
    return stol(readS());
  }
  public static long stol(String s){
    return Long.parseLong(s);
  }
  public static int readI(){
    return stoi(readS());
  }
  public static String[] readSs(){
    return readL().split(" ");
  }
  public static int[] readIs(){
    return stoi(readSs());
  }
  public static int stoi(String s){
    return Integer.parseInt(s);
  }
  public static int[] stoi(String s[]){
    int a[]=new int[s.length];
    for(int i=0;i<s.length;i++){
      a[i]=stoi(s[i]);
    }
    return a;
  }
  public static String itos(int i){
    return String.valueOf(i);
  }
  public static String[] itos(int[] a){
    String s[]=new String[a.length];
    for(int i=0;i<a.length;i++){
      s[i]=itos(a[i]);
    }
    return s;
  }
  public static String ctos(char c){
    return String.valueOf(c);
  }
  public static String cstos(char[] c){
    return new String(c);
  }
  public static char stoc(String s){
    return s.charAt(0);
  }
  public static char[] stocs(String s){
    return s.toCharArray();
  }
  public static int[] Itoi(Integer a[]){
    int[]result=new int[a.length];
    for(int i=0;i<a.length;i++){
      result[i]=a[i];
    }
    return result;
  }
}
0