#include <stdio.h>
// 4 bit version
int pdiv(int dividend, int divisor)
{
int qoutient = 0, remainder = dividend;
divisor <<= 4;
for(int i = 0; i < 5; i++)
{
remainder -= divisor;
if (remainder >= 0)
{
qoutient <<= 1;
qoutient |= 1;
}
else
{
remainder += divisor;
qoutient <<= 1;
}
divisor >>= 1;
}
return qoutient;
}
int main(void)
{
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgovLyA0IGJpdCB2ZXJzaW9uCmludCBwZGl2KGludCBkaXZpZGVuZCwgaW50IGRpdmlzb3IpCnsKCWludCBxb3V0aWVudCA9IDAsIHJlbWFpbmRlciA9IGRpdmlkZW5kOwoJZGl2aXNvciA8PD0gNDsKCglmb3IoaW50IGkgPSAwOyBpIDwgNTsgaSsrKQoJewoJCXJlbWFpbmRlciAtPSBkaXZpc29yOwoJCWlmIChyZW1haW5kZXIgPj0gMCkKCQl7CgkJCXFvdXRpZW50IDw8PSAxOwoJCQlxb3V0aWVudCB8PSAxOwoJCX0KCQllbHNlCgkJewoJCQlyZW1haW5kZXIgKz0gZGl2aXNvcjsKCQkJcW91dGllbnQgPDw9IDE7CgkJfQoJCWRpdmlzb3IgPj49IDE7Cgl9CglyZXR1cm4gcW91dGllbnQ7Cn0KCmludCBtYWluKHZvaWQpCnsKCXByaW50ZigiJWRcbiIsIHBkaXYoNCwyKSk7CglyZXR1cm4gMDsKfQ==