結果
| 問題 |
No.906 Y字グラフ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-10-11 22:29:35 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 533 bytes |
| コンパイル時間 | 1,505 ms |
| コンパイル使用メモリ | 167,212 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 08:20:21 |
| 合計ジャッジ時間 | 2,450 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define inv2 500000004
#define inv6 166666668
int main() {
long long n; cin >> n;
long long s = n-4;
long long all = ((s+2) % mod) * ((s+1) % mod) % mod * inv2 % mod;
long long three = s % 3 == 0 ? 1 : 0;
all = (all + mod - three) % mod;
long long two = ((s / 2 + 1) % mod + mod - three) % mod;
all = (all + mod - two * 3 % mod) % mod;
long long one = all * inv6 % mod;
cout << (one + two + three) % mod << endl;
return 0;
}