Untitled
#include <iostream> using namespace std; int main() { unsigned long long n, k; cin >> n >> k; unsigned long long m = n / k; unsigned long long S = k * m * (m + 1) / 2; cout << S << endl; return 0; }
Leave a Comment
#include <iostream> using namespace std; int main() { unsigned long long n, k; cin >> n >> k; unsigned long long m = n / k; unsigned long long S = k * m * (m + 1) / 2; cout << S << endl; return 0; }