Submission #12081815


Source Code Expand

Copy
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-8;

long long int N, M, K, L, R, H, W;
//int N, M, K, L, R, H, W;


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N >> K;
	long long int ans = 0;
	for (long long int i = K; i <= N + 1; i++) {
		L = i * (i - 1) / 2;
		R = N * i - L;
		ans += R - L+1;
	}
	cout << ans % MOD << endl;
}

Submission Info

Submission Time
Task D - Sum of Large Numbers
User olphe
Language C++ (GCC 9.2.1)
Score 400
Code Size 927 Byte
Status AC
Exec Time 3 ms
Memory 3652 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 19
Set Name Test Cases
Sample sample_01, sample_02, sample_03
All hand_01, hand_02, max_01, max_02, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, random_09, random_10, random_11, random_12, sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
hand_01 AC 2 ms 3524 KB
hand_02 AC 2 ms 3596 KB
max_01 AC 3 ms 3516 KB
max_02 AC 2 ms 3564 KB
random_01 AC 2 ms 3468 KB
random_02 AC 2 ms 3516 KB
random_03 AC 3 ms 3540 KB
random_04 AC 2 ms 3472 KB
random_05 AC 2 ms 3584 KB
random_06 AC 2 ms 3604 KB
random_07 AC 2 ms 3468 KB
random_08 AC 2 ms 3652 KB
random_09 AC 2 ms 3580 KB
random_10 AC 3 ms 3536 KB
random_11 AC 2 ms 3608 KB
random_12 AC 2 ms 3536 KB
sample_01 AC 2 ms 3580 KB
sample_02 AC 2 ms 3640 KB
sample_03 AC 2 ms 3512 KB