#include <iostream>
using namespace std;
class Unko
{
private:
static int counter;
const int number;
int value;
public:
Unko() : number(Unko::counter++), value(0) { }
Unko(const int v) : number(Unko::counter++), value(v) { }
~Unko() { cout << "Poo! (" << number << ')' << endl; }
operator int() const { return value * number; }
Unko operator + (const Unko& u1) const {
return Unko(u1.value + value);
}
};
int Unko::counter = 1;
int main() {
Unko u1(10);
Unko u2(100);
cout << u1 << endl;
cout << u2 << endl;
cout << u1 + u2 << endl;
cout << u1 + u2 << endl;
cout << u1 + u1 + u1 << endl;
// your code goes here
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgVW5rbwp7CnByaXZhdGU6CglzdGF0aWMgaW50IGNvdW50ZXI7Cgljb25zdCBpbnQgbnVtYmVyOwoJaW50IHZhbHVlOwpwdWJsaWM6CglVbmtvKCkgOiBudW1iZXIoVW5rbzo6Y291bnRlcisrKSwgdmFsdWUoMCkgeyB9CglVbmtvKGNvbnN0IGludCB2KSA6IG51bWJlcihVbmtvOjpjb3VudGVyKyspLCB2YWx1ZSh2KSB7IH0KCX5VbmtvKCkgeyBjb3V0IDw8ICJQb28hICgiIDw8IG51bWJlciA8PCAnKScgPDwgZW5kbDsgfQoJb3BlcmF0b3IgaW50KCkgY29uc3QgeyByZXR1cm4gdmFsdWUgKiBudW1iZXI7IH0KCQoJVW5rbyBvcGVyYXRvciArIChjb25zdCBVbmtvJiB1MSkgY29uc3QgewoJCXJldHVybiBVbmtvKHUxLnZhbHVlICsgdmFsdWUpOwoJfQp9OwoKaW50IFVua286OmNvdW50ZXIgPSAxOwoKaW50IG1haW4oKSB7CgkKCVVua28gdTEoMTApOwoJVW5rbyB1MigxMDApOwoJCgljb3V0IDw8IHUxIDw8IGVuZGw7Cgljb3V0IDw8IHUyIDw8IGVuZGw7Cgljb3V0IDw8IHUxICsgdTIgPDwgZW5kbDsKCWNvdXQgPDwgdTEgKyB1MiA8PCBlbmRsOwoJY291dCA8PCB1MSArIHUxICsgdTEgPDwgZW5kbDsKCQoJLy8geW91ciBjb2RlIGdvZXMgaGVyZQoJcmV0dXJuIDA7Cn0=