結果
問題 | No.1299 Random Array Score |
ユーザー | y61mpnl |
提出日時 | 2020-11-27 22:23:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 546 bytes |
コンパイル時間 | 2,186 ms |
コンパイル使用メモリ | 191,300 KB |
最終ジャッジ日時 | 2025-01-16 07:46:37 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:18:15: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘ll*’ {aka ‘long int*’} [-Wformat=] 18 | scanf("%lld %lld", &n, &k); | ~~~^ ~~ | | | | | ll* {aka long int*} | long long int* | %ld main.cpp:18:20: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 3 has type ‘ll*’ {aka ‘long int*’} [-Wformat=] 18 | scanf("%lld %lld", &n, &k); | ~~~^ ~~ | | | | | ll* {aka long int*} | long long int* | %ld main.cpp:22:19: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘ll*’ {aka ‘long int*’} [-Wformat=] 22 | scanf("%lld", &a); | ~~~^ ~~ | | | | | ll* {aka long int*} | long long int* | %ld main.cpp:28:16: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘ll’ {aka ‘long int’} [-Wformat=] 28 | printf("%lld\n", ans); | ~~~^ ~~~ | | | | | ll {aka long int} | long long int | %ld main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%lld %lld", &n, &k); | ~~~~~^~~~~~~~~~~~~~~~~~~~~ main.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | scanf("%lld", &a); | ~~~~~^~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> #define REP(i,b,e) for(int i=b;i<e;i++) using ll = int_fast64_t; const ll MOD = 998244353; ll modpow(ll a, ll p, ll m){ ll ret = 1; while(p){ if(p&1) ret = ret * a % m; a = a * a % m; p >>= 1; } return ret; } int main(){ ll n, k; scanf("%lld %lld", &n, &k); ll sum = 0; REP(i, 0, n){ ll a; scanf("%lld", &a); sum = (sum + a) % MOD; } ll ans = modpow(2, k, MOD); ans = ans * sum % MOD; printf("%lld\n", ans); return 0; }