-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLOJ 1354.cpp
51 lines (51 loc) · 999 Bytes
/
LOJ 1354.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
using namespace std;
#define pi 2*acos(0.0)
inline int b2d(char *s)
{
int b=0,a=strlen(s);
for(int i=a-1;i>=0;i--)
b+=((s[i]-48)*pow(2,i));
return b;
}
int main()
{
int a[4],t;
char s[100];
scanf("%d",&t);
for(int i=1;i<=t;i++)
{
scanf("%d.%d.%d.%d",&a[0],&a[1],&a[2],&a[3]);
getchar();
scanf("%s",s);
int flag=1,l=0;
for(int j=0;j<4;j++)
{
int b=0;
for(int k=7;k>=0;k--,l++)
b+=((s[l]-48)*pow(2,k));
l++;
if(b!=a[j])flag=0;
}
if(flag)printf("Case %d: Yes\n",i);
else printf("Case %d: No\n",i);
}
return 0;
}