#include <iostream>
#include <string>
bool f(std::string const &s, bool v)
{
std::cout << s << v << ' ';
return v;
}
int main()
{
std::cout << "a || b && c" << std::endl;
for(unsigned i = 0; i < 8; ++i)
{
if(f("a", i&0b100) || f("b", i&0b10) && f("c", i&0b1))
{
std::cout << "true" << std::endl;
}
else
{
std::cout << "false" << std::endl;
}
}
std::cout << "a && b || c" << std::endl;
for(unsigned i = 0; i < 8; ++i)
{
if(f("a", i&0b100) && f("b", i&0b10) || f("c", i&0b1))
{
std::cout << " true" << std::endl;
}
else
{
std::cout << " false" << std::endl;
}
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgoKYm9vbCBmKHN0ZDo6c3RyaW5nIGNvbnN0ICZzLCBib29sIHYpCnsKCXN0ZDo6Y291dCA8PCBzIDw8IHYgPDwgJyAnOwoJcmV0dXJuIHY7Cn0KCmludCBtYWluKCkKewoJc3RkOjpjb3V0IDw8ICJhIHx8IGIgJiYgYyIgPDwgc3RkOjplbmRsOwoJZm9yKHVuc2lnbmVkIGkgPSAwOyBpIDwgODsgKytpKQoJewoJCWlmKGYoImEiLCBpJjBiMTAwKSB8fCBmKCJiIiwgaSYwYjEwKSAmJiBmKCJjIiwgaSYwYjEpKQoJCXsKCQkJc3RkOjpjb3V0IDw8ICJ0cnVlIiA8PCBzdGQ6OmVuZGw7CgkJfQoJCWVsc2UKCQl7CgkJCXN0ZDo6Y291dCA8PCAiZmFsc2UiIDw8IHN0ZDo6ZW5kbDsKCQl9Cgl9CglzdGQ6OmNvdXQgPDwgImEgJiYgYiB8fCBjIiA8PCBzdGQ6OmVuZGw7Cglmb3IodW5zaWduZWQgaSA9IDA7IGkgPCA4OyArK2kpCgl7CgkJaWYoZigiYSIsIGkmMGIxMDApICYmIGYoImIiLCBpJjBiMTApIHx8IGYoImMiLCBpJjBiMSkpCgkJewoJCQlzdGQ6OmNvdXQgPDwgIiB0cnVlIiA8PCBzdGQ6OmVuZGw7CgkJfQoJCWVsc2UKCQl7CgkJCXN0ZDo6Y291dCA8PCAiIGZhbHNlIiA8PCBzdGQ6OmVuZGw7CgkJfQoJfQp9Cg==