Submission #12120347


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define mod 1000000007
#define pb push_back
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector< pi > 
#define IOS ios_base::sync_with_stdio(false),cin.tie(NULL)
const int N=500003;
int main()
{
	ll n,k;
	cin>>n>>k;
	ll res=0;
	for(ll i=n+1;i>=k;i--)
	{
		res+=(n+1-i)*i%mod;
		res+=1;
		
		res%=mod;
	}
	cout<<res<<"\n";
	return 0;
}

Submission Info

Submission Time
Task D - Sum of Large Numbers
User sarwarkhan
Language C++ (GCC 9.2.1)
Score 400
Code Size 442 Byte
Status AC
Exec Time 3 ms
Memory 3632 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 3552 KB
max_02 AC 3 ms 3524 KB
random_01 AC 3 ms 3520 KB
random_02 AC 2 ms 3408 KB
random_03 AC 2 ms 3408 KB
random_04 AC 2 ms 3632 KB
random_05 AC 2 ms 3440 KB
random_06 AC 2 ms 3624 KB
random_07 AC 2 ms 3552 KB
random_08 AC 3 ms 3392 KB
random_09 AC 3 ms 3584 KB
random_10 AC 2 ms 3624 KB
random_11 AC 2 ms 3548 KB
random_12 AC 2 ms 3444 KB
sample_01 AC 2 ms 3448 KB
sample_02 AC 2 ms 3392 KB
sample_03 AC 3 ms 3524 KB