結果
| 問題 |
No.988 N×Mマス計算(総和)
|
| コンテスト | |
| ユーザー |
toto
|
| 提出日時 | 2025-03-26 13:15:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 698 bytes |
| コンパイル時間 | 314 ms |
| コンパイル使用メモリ | 28,544 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-03-26 13:16:04 |
| 合計ジャッジ時間 | 4,510 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 2 |
| other | RE * 19 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:21: warning: format ‘%d’ expects a matching ‘int*’ argument [-Wformat=]
6 | scanf("%d%d%d",&vertical,&horizontal);
| ~^
| |
| int*
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);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%ld",&mod);
| ~~~~~^~~~~~~~~~~~
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%c",&symbol);
| ~~~~~^~~~~~~~~~~~~~
main.cpp:17:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%lld",&arrh[i]);
| ~~~~~^~~~~~~~~~~~~~~~~
main.cpp:21:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
21 | scanf("%lld",&arrv[i]);
| ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(){
// 縦の長さ・横の長さ
int vertical,horizontal;
scanf("%d%d%d",&vertical,&horizontal);
// 割り
long mod = 0;
scanf("%ld",&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);
}
toto