結果
| 問題 |
No.72 そろばん Med
|
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-04-09 22:39:23 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 466 bytes |
| コンパイル時間 | 183 ms |
| コンパイル使用メモリ | 29,312 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 04:53:28 |
| 合計ジャッジ時間 | 954 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
// yukicoder: No.72 そろばん Med
// 2019.4.9 bal4u
// 下部に珠がx個だとすると、表現する最大数は (x+1)*(n-x)+x
// = nx - x^2 + n
#include <stdio.h>
#define M 1000007
long long N;
int calc(long long x)
{
int t = ((x % M) * ((N - x) % M)) % M + N % M;
return (int)(t % M);
}
int main()
{
long long x;
int a, ans;
scanf("%lld", &N);
x = N / 2;
ans = calc(x);
a = calc(x + 1);
if (a > ans) ans = a;
printf("%d\n", ans);
return 0;
}
bal4u