結果
| 問題 | No.72 そろばん Med | 
| コンテスト | |
| ユーザー |  bal4u | 
| 提出日時 | 2019-04-09 22:38:39 | 
| 言語 | C (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 5,000 ms | 
| コード長 | 472 bytes | 
| コンパイル時間 | 254 ms | 
| コンパイル使用メモリ | 28,928 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-05 04:52:22 | 
| 合計ジャッジ時間 | 1,251 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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);
	x++;
	a = calc(x + 1);
	if (a > ans) ans = a;
	printf("%d\n", ans);
	return 0;
}
            
            
            
        