結果
| 問題 |
No.988 N×Mマス計算(総和)
|
| コンテスト | |
| ユーザー |
MarcusAureliusAntoninus
|
| 提出日時 | 2020-02-14 21:35:36 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 2,000 ms |
| コード長 | 432 bytes |
| コンパイル時間 | 1,793 ms |
| コンパイル使用メモリ | 192,100 KB |
| 最終ジャッジ日時 | 2025-01-09 00:04:49 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:27: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘int64_t*’ {aka ‘long int*’} [-Wformat=]
12 | scanf("%lld", &tmp);
| ~~~^ ~~~~
| | |
| | int64_t* {aka long int*}
| long long int*
| %ld
main.cpp:18:27: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘int64_t*’ {aka ‘long int*’} [-Wformat=]
18 | scanf("%lld", &tmp);
| ~~~^ ~~~~
| | |
| | int64_t* {aka long int*}
| long long int*
| %ld
main.cpp:24:20: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int64_t’ {aka ‘long int’} [-Wformat=]
24 | printf("%lld\n", ans);
| ~~~^ ~~~
| | |
| | int64_t {aka long int}
| long long int
| %ld
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d%d%d %c", &N, &M, &K, &op);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%lld", &tmp);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:18:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | scanf("%lld", &tmp
ソースコード
#include <bits/stdc++.h>
int main()
{
int N, M, K;
char op;
scanf("%d%d%d %c", &N, &M, &K, &op);
int64_t A{}, B{};
for (int i{}; i < M; i++)
{
int64_t tmp;
scanf("%lld", &tmp);
B = (B + tmp) % K;
}
for (int i{}; i < N; i++)
{
int64_t tmp;
scanf("%lld", &tmp);
A = (A + tmp) % K;
}
int64_t ans{};
if (op == '+') ans = (M * A % K + N * B % K) % K;
else ans = A * B % K;
printf("%lld\n", ans);
return 0;
}
MarcusAureliusAntoninus