結果
| 問題 | No.988 N×Mマス計算(総和) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-14 21:29:54 |
| 言語 | C++17(gcc12) (gcc 12.4.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 2,000 ms |
| コード長 | 816 bytes |
| 記録 | |
| コンパイル時間 | 967 ms |
| コンパイル使用メモリ | 112,808 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-08 19:31:03 |
| 合計ジャッジ時間 | 2,020 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:27:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
27 | for (auto &&i : u) scanf("%lld", &i);
| ~~~~~^~~~~~~~~~~~
main.cpp:28:29: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
28 | for (auto &&j : v) scanf("%lld", &j);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>
static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;
template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;
#include <cassert>
int main() {
ll n, m, k;
cin >> n >> m >> k;
char c;
cin >> c;
vector<ll> v(n), u(m);
for (auto &&i : u) scanf("%lld", &i);
for (auto &&j : v) scanf("%lld", &j);
ll x = accumulate(v.begin(),v.end(), 0LL), y = accumulate(u.begin(),u.end(), 0LL);
if(c == '+'){
cout << (x%k*m%k+y%k*n%k)%k << "\n";
}else {
cout << x%k*(y%k)%k << "\n";
}
return 0;
}