結果
| 問題 |
No.1299 Random Array Score
|
| コンテスト | |
| ユーザー |
yoshykai
|
| 提出日時 | 2020-11-27 21:53:03 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 263 ms / 2,000 ms |
| コード長 | 2,777 bytes |
| コンパイル時間 | 3,012 ms |
| コンパイル使用メモリ | 88,548 KB |
| 実行使用メモリ | 45,428 KB |
| 最終ジャッジ日時 | 2024-07-26 12:22:32 |
| 合計ジャッジ時間 | 11,098 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
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;
}
}
yoshykai