結果
問題 |
No.988 N×Mマス計算(総和)
|
ユーザー |
![]() |
提出日時 | 2025-03-26 13:13:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 672 bytes |
コンパイル時間 | 348 ms |
コンパイル使用メモリ | 28,160 KB |
実行使用メモリ | 14,776 KB |
最終ジャッジ日時 | 2025-03-26 13:14:03 |
合計ジャッジ時間 | 4,426 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("%d%d%d",&vertical,&horizontal,&mod); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%c",&symbol); | ~~~~~^~~~~~~~~~~~~~ main.cpp:15:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%lld",&arrh[i]); | ~~~~~^~~~~~~~~~~~~~~~~ main.cpp:19:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%lld",&arrv[i]); | ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(){ // 縦の長さ・横の長さ・割り int vertical,horizontal,mod; scanf("%d%d%d",&vertical,&horizontal,&mod); // 計算方法 char symbol; scanf("%c",&symbol); long long arrv[vertical],arrh[horizontal]; // 横配列の値 for(int i = 0;i < horizontal;i ++){ scanf("%lld",&arrh[i]); } // 縦配列の値 for(int i = 0;i < vertical;i ++){ scanf("%lld",&arrv[i]); } long long ans = 0; for(int i = 0;i < vertical;i ++){ for(int j = 0;j < horizontal;j ++){ if(symbol == '+'){ ans += arrv[i] + arrh[j]; ans %= mod; }else{ ans *= arrv[i] * arrh[j]; ans %= mod; } } } printf("%lld",ans); }