#include <iostream>
int main()
{
int rice_count = 0;
std::cout << "Please, input maximum number of rice: ";
std::cin >> rice_count;
int square = 1;
int square_count = 1;
while(square <= rice_count)
{
std::cout << square_count << " square on the desk will have " << square << " rices" << std::endl;
square_count++;
if(square == 1)
{
square++;
}
else
{
square*=square;
}
}
std::cout << square_count << " square on the desk will have " << square << " rices" << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKaW50IG1haW4oKQp7CiAgICBpbnQgcmljZV9jb3VudCA9IDA7CiAgICBzdGQ6OmNvdXQgPDwgIlBsZWFzZSwgaW5wdXQgbWF4aW11bSBudW1iZXIgb2YgcmljZTogIjsKICAgIHN0ZDo6Y2luID4+IHJpY2VfY291bnQ7CiAgICBpbnQgc3F1YXJlID0gMTsKICAgIGludCBzcXVhcmVfY291bnQgPSAxOwogICAgd2hpbGUoc3F1YXJlIDw9IHJpY2VfY291bnQpCiAgICB7CiAgICAgICAgc3RkOjpjb3V0IDw8IHNxdWFyZV9jb3VudCA8PCAiIHNxdWFyZSBvbiB0aGUgZGVzayB3aWxsIGhhdmUgIiA8PCBzcXVhcmUgPDwgIiByaWNlcyIgPDwgc3RkOjplbmRsOwogICAgICAgIHNxdWFyZV9jb3VudCsrOwogICAgICAgIGlmKHNxdWFyZSA9PSAxKQogICAgICAgIHsKICAgICAgICAgICAgc3F1YXJlKys7CiAgICAgICAgfQogICAgICAgIGVsc2UKICAgICAgICB7CiAgICAgICAgICAgIHNxdWFyZSo9c3F1YXJlOwogICAgICAgIH0KICAgIH0KICAgIHN0ZDo6Y291dCA8PCBzcXVhcmVfY291bnQgPDwgIiBzcXVhcmUgb24gdGhlIGRlc2sgd2lsbCBoYXZlICIgPDwgc3F1YXJlIDw8ICIgcmljZXMiIDw8IHN0ZDo6ZW5kbDsKCiAgICByZXR1cm4gMDsKfQo=