Advertisement
erfanul007

LOJ 1354

Apr 14th, 2021
635
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int a,b,c,d,e,f,g,h,n,i,x,r,s;
  5.     scanf("%d",&n);
  6.     for(i=1;i<=n;i++){
  7.         scanf("%d%*c%d%*c%d%*c%d",&a,&b,&c,&d);
  8.         scanf("%d%*c%d%*c%d%*c%d",&e,&f,&g,&h);
  9.         s=0;
  10.         x=1;
  11.         while(a>0){
  12.             s=s+((a%2)*x);
  13.             x=x*10;
  14.             a=a/2;
  15.         }
  16.         a=s;
  17.         s=0;
  18.         x=1;
  19.         while(b>0){
  20.             s=s+((b%2)*x);
  21.             x=x*10;
  22.             b=b/2;
  23.         }
  24.         b=s;
  25.         s=0;
  26.         x=1;
  27.         while(c>0){
  28.             s=s+((c%2)*x);
  29.             x=x*10;
  30.             c=c/2;
  31.         }
  32.         c=s;
  33.         s=0;
  34.         x=1;
  35.         while(d>0){
  36.             s=s+((d%2)*x);
  37.             x=x*10;
  38.             d=d/2;
  39.         }
  40.         d=s;
  41.         if(a==e && b==f && c==g && d==h)
  42.             printf("Case %d: Yes\n",i);
  43.         else
  44.             printf("Case %d: No\n",i);
  45.     }
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement