#include <iostream>
#include <algorithm>
int main()
{
//int i, j;
int sum = 0;
const int num = 36;
int* myDataX = new int[num];
int* myDataY = new int[num];
float value = 0;
for (int a = 0; a < num; a++)
{
myDataX[a] = a;
myDataY[a] = a;
}
for (int i = 0; i < num; i++)
{
float x = myDataX[i];
for (int j = 0; j < num; j++)
{
float y = myDataY[j];
value = x + y;
sum += value;
}
}
std::cout << "sum: " << sum << std::endl;
sum = (std::accumulate(myDataX, myDataX + num, 0.f) + std::accumulate(myDataY, myDataY + num, 0.f)) * num;
std::cout << "sum: " << sum << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKaW50IG1haW4oKQp7CiAKICAgIC8vaW50IGksIGo7CiAgICBpbnQgc3VtID0gMDsKICAgIGNvbnN0IGludCBudW0gPSAzNjsKICAgIGludCogIG15RGF0YVggPSBuZXcgaW50W251bV07CiAgICBpbnQqICBteURhdGFZID0gbmV3IGludFtudW1dOwogICAgZmxvYXQgdmFsdWUgPSAwOwogCiAKIAogICAgZm9yIChpbnQgYSA9IDA7IGEgPCBudW07IGErKykKICAgIHsKICAgICAgICBteURhdGFYW2FdID0gYTsKICAgICAgICBteURhdGFZW2FdID0gYTsKICAgIH0KIAogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBudW07IGkrKykKICAgIHsKICAgICAgICBmbG9hdCB4ID0gbXlEYXRhWFtpXTsKIAogICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgbnVtOyBqKyspCiAgICAgICAgewogICAgICAgICAgICBmbG9hdCB5ID0gbXlEYXRhWVtqXTsKICAgICAgICAgICAgdmFsdWUgPSB4ICsgeTsKICAgICAgICAgICAgc3VtICs9IHZhbHVlOwogICAgICAgIH0KIAogICAgfQogICAgCiAgICBzdGQ6OmNvdXQgPDwgInN1bTogIiA8PCBzdW0gPDwgc3RkOjplbmRsOwoKICAgIHN1bSA9IChzdGQ6OmFjY3VtdWxhdGUobXlEYXRhWCwgbXlEYXRhWCArIG51bSwgMC5mKSArIHN0ZDo6YWNjdW11bGF0ZShteURhdGFZLCBteURhdGFZICsgbnVtLCAwLmYpKSAqIG51bTsKIAogICAgc3RkOjpjb3V0IDw8ICJzdW06ICIgPDwgc3VtIDw8IHN0ZDo6ZW5kbDsKICAgIAogICAgcmV0dXJuIDA7Cn0=