4 条题解
-
1
#include <bits/stdc++.h> using namespace std; #define int long long const int mod = 1e9+7; void solve(){ int n; cin >> n; n--; //由于给的是点,使用我们要转化为段 int ans = 0; for(int i = 1; i <= n; i++){ ans = (ans + (n - i + 1) * (n - i + 1) * i) % mod; } cout << ans << '\n'; } signed main(){ ios::sync_with_stdio(0); cin.tie(0),cout.tie(0); int T=1; // cin >> T; while(T--){ solve(); } return 0; }
- 1
信息
- ID
- 1185
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 7
- 标签
- (无)
- 递交数
- 168
- 已通过
- 35
- 上传者