結果

問題 No.988 N×Mマス計算(総和)
ユーザー toto
提出日時 2025-03-26 13:43:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 618 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 28,032 KB
実行使用メモリ 14,776 KB
最終ジャッジ日時 2025-03-26 13:43:35
合計ジャッジ時間 4,609 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 8 TLE * 1 -- * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%lld%lld%lld",&tate,&yoko,&mod);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%c",str);
      |         ~~~~~^~~~~~~~~~
main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |                 scanf("%lld",&arryoko[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~
main.cpp:16:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |                 scanf("%lld",&arrtate[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	// 縦の長さ・横の長さ・割る値
	long long tate,yoko,mod;
	scanf("%lld%lld%lld",&tate,&yoko,&mod);
	
	char str[1];
	scanf("%c",str);
	
	long long arrtate[tate],arryoko[yoko];
	for(long long i = 0;i < yoko;i ++){
		scanf("%lld",&arryoko[i]);
	}
	for(long long i = 0;i < tate;i ++){
		scanf("%lld",&arrtate[i]);
	}
	
	long long ans = 0;
	for(long long i = 0;i < tate;i ++){
		for(long long j = 0;j < yoko;j ++){
			if(str[0] == '+'){
				ans = (ans + arrtate[i] + arryoko[j]) / mod;
			}else{
				ans = ans + (arrtate[i] * arryoko[j]) / mod;
			}
		}
	}
	printf("%lld",ans);
}
0