QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#227793 | #2937. CIDR | Thallium54# | WA | 0ms | 3740kb | C++20 | 1001b | 2023-10-27 23:21:44 | 2023-10-27 23:21:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
#define pii pair<int, int>
const int N = 2e5 + 100;
const int inf = 1e9;
const ll mod = 998244353;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) {
ll x = 0;
int k;
for (int j = 0; j < 4; j++) {
char c;
cin >> k;
x = (x << 8) + k;
if (j < 3) cin >> c;
}
a[i] = x;
}
for (int b = 31; b >= 0; b--) {
int same = 1;
for (int i = 0; i < n; i++) {
if ((a[i] >> b & 1) != (a[0] >> b & 1)) {
same = 0;
break;
}
}
if (!same) {
cout << 31 - b << endl;
break;
}
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3600kb
input:
4 10.0.0.1 10.0.0.24 10.0.0.8 10.0.0.16
output:
27
result:
ok single line: '27'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
5 10.0.0.1 10.0.0.24 10.0.0.8 10.1.0.1 10.0.0.16
output:
15
result:
ok single line: '15'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
2 127.0.0.1 127.0.0.53
output:
26
result:
ok single line: '26'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
3 0.0.0.128 0.0.0.3 0.0.128.5
output:
16
result:
ok single line: '16'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3504kb
input:
5 123.123.123.123 123.123.123.123 123.123.123.123 123.123.123.123 123.123.123.123
output:
result:
wrong answer 1st lines differ - expected: '32', found: ''