結果

問題 No.987 N×Mマス計算(基本)
ユーザー sasa
提出日時 2025-03-18 09:33:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 528 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 27,648 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-18 09:33:24
合計ジャッジ時間 1,036 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 9 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d%d",&tate,&yoko);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%s",symbol);
      |         ~~~~~^~~~~~~~~~~~~
main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 scanf("%ld",&horizontal[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:15:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |                 scanf("%ld",&vertical[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(void){
	// 縦・横の長さ
	int tate,yoko;
	scanf("%d%d",&tate,&yoko);
	// 計算記号
	char symbol[1];
	scanf("%s",symbol);
	// 各数値
	long vertical[tate],horizontal[yoko];
	for(int i = 0;i < yoko;i ++){
		scanf("%ld",&horizontal[i]);
	}
	for(int i = 0;i < tate;i ++){
		scanf("%ld",&vertical[i]);
		for(int j = 0;j < yoko;j ++){
			if(symbol == "*"){
				printf("%ld ",vertical[i] * horizontal[j]);
			}else{
				printf("%ld ",vertical[i] + horizontal[j]);
			}
		}
		printf("\n");
	}
	
	
}
0