結果

問題 No.987 N×Mマス計算(基本)
ユーザー MarcusAureliusAntoninusMarcusAureliusAntoninus
提出日時 2020-02-14 21:25:47
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 2,165 ms
コンパイル使用メモリ 194,268 KB
最終ジャッジ日時 2025-01-08 23:58:29
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
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:20:36: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int64_t’ {aka ‘long int’} [-Wformat=]
   20 |                         printf("%lld%c", ans, j + 1 == M? '\n': ' ');
      |                                 ~~~^     ~~~
      |                                    |     |
      |                                    |     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 %c", &N, &M, &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 |            

ソースコード

diff #

#include <bits/stdc++.h>

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

	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];
			printf("%lld%c", ans, j + 1 == M? '\n': ' ');
		}

	return 0;
}
0