結果

問題 No.988 N×Mマス計算(総和)
ユーザー MarcusAureliusAntoninus
提出日時 2020-02-14 21:27:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 438 bytes
コンパイル時間 1,916 ms
コンパイル使用メモリ 193,800 KB
最終ジャッジ日時 2025-01-09 00:01:22
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 TLE * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:27: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘long int*’ [-Wformat=]
   10 |                 scanf("%lld", &e);
      |                        ~~~^   ~~
      |                           |   |
      |                           |   long int*
      |                           long long int*
      |                        %ld
main.cpp:12:27: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘long int*’ [-Wformat=]
   12 |                 scanf("%lld", &e);
      |                        ~~~^   ~~
      |                           |   |
      |                           |   long int*
      |                           long long int*
      |                        %ld
main.cpp:23:20: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int64_t’ {aka ‘long int’} [-Wformat=]
   23 |         printf("%lld\n", sum);
      |                 ~~~^     ~~~
      |                    |     |
      |                    |     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:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%lld", &e);
      |                 ~~~~~^~~~~~~~~~~~
main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 scanf("%lld", &e);
      |                 ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

int main()
{
	int N, M, K;
	char op;
	scanf("%d%d%d %c", &N, &M, &K, &op);
	std::vector<int64_t> A(N), B(M);
	for (auto& e: B)
		scanf("%lld", &e);
	for (auto& e: A)
		scanf("%lld", &e);

	int64_t sum{};
	for (int i{}; i < N; i++)
		for (int j{}; j < M; j++)
		{
			int64_t ans{};
			if (op == '+') ans = A[i] + B[j];
			else ans = A[i] * B[j];
			sum = (sum + ans) % K;
		}
	printf("%lld\n", sum);

	return 0;
}
0