ABC041 B - 直方体
問題概要
直方体の体積を求める問題
解法
ただ計算するだけだが、2辺をかけるとlong long型を超える可能性があるので、modをとることでオーバーフローを防ぐ。 体積 = a * b % mod * c % mod
ミス
特になし
コード
#include <iostream> #include <cstdio> using namespace std; typedef long long ll; static const int mod = 1000000007; int main(void){ ll a, b, c; cin >> a >> b >> c; printf("%lld\n", a * b % mod * c % mod); return 0; }