結果

問題 No.987 N×Mマス計算(基本)
ユーザー Maeda
提出日時 2025-03-19 14:37:09
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 25,600 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-19 14:37:10
合計ジャッジ時間 1,122 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d %d\n",&n,&m);
      |         ^~~~~~~~~~~~~~~~~~~~~~
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%c",&symbol);
      |         ^~~~~~~~~~~~~~~~~~~
main.c:11:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                 scanf("%lld",&horizontal[i]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:14:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |                 scanf("%lld",&vertical[i]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

void main(void) {
	int n,m;
	scanf("%d %d\n",&n,&m);
	long long int horizontal[m];
	long long int vertical[n];
	char symbol = 'a';
	scanf("%c",&symbol);
	for(int i = 0; i < m ; i++){
		scanf("%lld",&horizontal[i]);
	}
	for(int i = 0; i < n ; i++){
		scanf("%lld",&vertical[i]);
	}

	for(int i = 0 ; i < n ; i ++){
		for(int j = 0 ; j < m ; j++){
			if(symbol == '+'){
			printf("%lld",horizontal[j] + vertical[i]);
			}else{
				printf("%lld",horizontal[j] * vertical[i]);
			}
			if(j != m-1){
				printf(" ");
			}
		}
		printf("\n");
	}

}
0