結果
| 問題 |
No.906 Y字グラフ
|
| コンテスト | |
| ユーザー |
ats5515
|
| 提出日時 | 2019-10-11 22:36:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 692 bytes |
| コンパイル時間 | 1,012 ms |
| コンパイル使用メモリ | 81,168 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 08:28:29 |
| 合計ジャッジ時間 | 1,583 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 28 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
int n = (N - 1) % MOD;
int inv6 = (MOD + 1) / 6;
int inv2 = (MOD + 1) / 2;
int a = (n - 2) * (n - 1) % MOD;
a = (a * inv2) % MOD;
int b = ((N - 2) / 2) % MOD;
int c = 0;
if ((N - 1) % 3 == 0) {
c = 1;
}
//cerr << a << " " << b << endl;
int res = (a + 3 * b + 2 * c) % MOD;
res = (100 * MOD + res) % MOD;
res = (res * inv6) % MOD;
cout << res << endl;
}
ats5515