結果
| 問題 |
No.1260 たくさんの多項式
|
| コンテスト | |
| ユーザー |
leaf_1415
|
| 提出日時 | 2020-10-16 23:36:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 74 ms / 2,000 ms |
| コード長 | 645 bytes |
| コンパイル時間 | 795 ms |
| コンパイル使用メモリ | 54,392 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-21 00:16:12 |
| 合計ジャッジ時間 | 6,216 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 61 |
ソースコード
#include <iostream>
#define llint long long
#define mod 1000000007
using namespace std;
llint n;
int main(void)
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
llint ans = 0;
for(int i = 2; i <= min(n, 1000000LL); i++){
for(llint t = n; t; t /= i) ans += t % i, ans %= mod;
}
llint inv2 = (mod+1)/2;
for(int i = 1; i <= 1000000; i++){
llint l = n/(i+1)+1, r = n/i;
l = max(l, 1000001LL);
if(l > r) continue;
llint b = n%r, L = (r-l) % mod;
ans += (L+1) * b % mod, ans %= mod;
ans += L * (L+1) % mod * inv2 % mod * i % mod, ans %= mod;
ans += (L+1) * i % mod, ans %= mod;
}
cout << ans << endl;
return 0;
}
leaf_1415