fork(2) download
  1. #include <stdio.h>
  2.  
  3. int div3(int x) {
  4. int a = x>>4;
  5. int b = x&0x0f;
  6. int y = a + (a<<2);
  7. b = a+b;
  8. y+=((b<<2)+(b)+(b>>1))>>4;
  9. return y;
  10. }
  11. int main(void) {
  12. // your code goes here
  13. for(int i=0;i<256;i++){
  14. int y = div3(i);
  15. if(y!=i/3){
  16. printf("y=%d, i/3=%d, i=%d\n",y,i/3,i);
  17. }
  18. }
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 5412KB
stdin
Standard input is empty
stdout
Standard output is empty