23 lines
513 B
C++
23 lines
513 B
C++
#include <iostream>
|
|
using namespace std;
|
|
int main(){
|
|
// Sn = n + n*n
|
|
// Smi =
|
|
// bm,n = 2mn - m + 1
|
|
int m,n;
|
|
while (cin >> n >> m){
|
|
int i = 1;
|
|
for(;i<=n/m;i++){
|
|
cout << 2*m*i - m + 1 ;cout << ((i == n/m)?"":" ");
|
|
if(i == n/m){
|
|
if(n%m!=0)
|
|
cout << ' ' << (n*(n+1)-i*m*(i*m + 1))/(n%m) << endl;
|
|
else
|
|
cout << endl;
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
return 0;
|
|
} |