#include <stdio.h>
char lower(char c)
{
if ((c >> 5) == 0x2) { // 上位3ビットが010ならば
return c ^ 0x20;
} else {
return c;
}
}
char upper(char c)
{
if ((c >> 5) == 0x3) { // 上位3ビットが011ならば
return c ^ 0x20;
} else {
return c;
}
}
void printc(char c)
{
int i;
for (i = 7; i >= 0; i--) {
printf("%c", '0' + ((c
>> i
) & 1)); if (i % 4 == 0) {
}
}
}
int main()
{
char c, ret;
printc(c);
ret = lower(c);
printc(ret);
ret = upper(c);
printc(ret);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgpjaGFyIGxvd2VyKGNoYXIgYykKewoJaWYgKChjID4+IDUpID09IDB4MikgewkvLyDkuIrkvY0z44OT44OD44OI44GMMDEw44Gq44KJ44GwCgkJcmV0dXJuIGMgXiAweDIwOwoJfSBlbHNlIHsKCQlyZXR1cm4gYzsKCX0KfQoKY2hhciB1cHBlcihjaGFyIGMpCnsKCWlmICgoYyA+PiA1KSA9PSAweDMpIHsJLy8g5LiK5L2NM+ODk+ODg+ODiOOBjDAxMeOBquOCieOBsAoJCXJldHVybiBjIF4gMHgyMDsKCX0gZWxzZSB7CgkJcmV0dXJuIGM7Cgl9Cn0KCnZvaWQgcHJpbnRjKGNoYXIgYykKewoJaW50CWk7CgoJZm9yIChpID0gNzsgaSA+PSAwOyBpLS0pIHsKCQlwcmludGYoIiVjIiwgJzAnICsgKChjID4+IGkpICYgMSkpOwoJCWlmIChpICUgNCA9PSAwKSB7CgkJCXByaW50ZigiJWMiLCBpID8gJyAnIDogJ1xuJyk7CgkJfQoJfQp9CgppbnQgbWFpbigpCnsKCWNoYXIJYywgcmV0OwoKCXNjYW5mKCIlYyIsICZjKTsKCXByaW50ZigiJWM6IiwgYyk7CglwcmludGMoYyk7CglyZXQgPSBsb3dlcihjKTsKCXByaW50ZigiJWM6IiwgcmV0KTsKCXByaW50YyhyZXQpOwoJcmV0ID0gdXBwZXIoYyk7CglwcmludGYoIiVjOiIsIHJldCk7CglwcmludGMocmV0KTsKCXJldHVybiAwOwp9Cg==