Advertisement
Farjana_akter

Untitled

Jan 29th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int binary[50000],binary2[50000];
  4. int bin(int x)
  5. {
  6. int deci=0,i=0,rem;
  7. while(x!=0)
  8. {
  9. rem=x%10;
  10. x/=10;
  11. deci+=(rem*pow(2,i));
  12. ++i;
  13. }
  14. return deci;
  15. }
  16. int main()
  17. {
  18. long long int a,a1,a2,b,b1,b2,c,c1,c2,d,d1,d2,t,i,j,k;
  19. cin>>t;
  20. for(i=1;i<=t;i++)
  21. {
  22. scanf("%lld.%lld.%lld.%lld",&a,&b,&c,&d);
  23. scanf("%lld.%lld.%lld.%lld",&a1,&b1,&c1,&d1);
  24. a2=bin(a1);
  25. b2=bin(b1);
  26. c2=bin(c1);
  27. d2=bin(d1);
  28. if(a2==a && b2==b && c2==c && d2==d)
  29. cout<<"Case "<<i<<": "<<"Yes"<<endl;
  30. else
  31. cout<<"Case "<<i<<": "<<"No"<<endl;
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement