結果
問題 | No.72 そろばん Med |
ユーザー |
👑 |
提出日時 | 2019-04-20 01:17:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 504 bytes |
コンパイル時間 | 579 ms |
コンパイル使用メモリ | 71,988 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 17:57:49 |
合計ジャッジ時間 | 1,226 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <cstdio> #include <cstdlib> #include <cstddef> #include <vector> #include <algorithm> #include <cmath> #include <string> #include <iostream> #include <iomanip> #define L64 long long #define MOD (1000007LL) int main(void) { L64 n, res; std::cin >> n; if(n % 2 == 0){ n = n / 2LL + 1LL; n = n % MOD; res = n * n - 1LL; } else { n = (n - 1) / 2 + 1LL; n = n % MOD; res = n * (n + 1) - 1LL; } res = res % 1000007LL; std::cout << res << std::endl; return 0; }