QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#708893#2937. CIDRsefnuray#RE 0ms0kbPython31.4kb2024-11-04 09:19:192024-11-04 09:19:20

Judging History

你现在查看的是最新测评结果

  • [2024-11-04 09:19:20]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-11-04 09:19:19]
  • 提交

answer

import sys                        #importing libraries
import math
import queue
import itertools
import heapq
from collections import defaultdict

MOD= int(1e9 + 7)
 
input = sys.stdin.readline
cnt=defaultdict(int)
def readString():
    s=input()
    return list(s[:len(s) - 1])
 
def outList(res):
    for r in res[:-1]:
        sys.stdout.write(str(r)+" ")
    sys.stdout.write(str(res[-1])+"\n")

def out(output):
    sys.stdout.write(str(output)+"\n")

def outE(output):
    sys.stdout.write(str(output))


def comb(n, r):
    if r == 0 or n == 0:
        return 1
    if r > n // 2:
        return comb(n, n - r)
    res = 1
    for k in range(1, r + 1):
        res *= n - k + 1
        res //= k
    return res


def solve():
    # read 
    n= int(input())
    parts=[]
    for i in range(4):
        parts.append([])

    for i in range(n):
        d= input()
        bits= [int(i) for i in d.split('.')]
        for i,b in enumerate(bits):
            parts[i].append(b)

    ans=0
    for i,p in enumerate(parts):
        if(len(set(p))==1):
            ans+=8
            continue
        zeros=0
        for n in p:
            b= bin(n)[2:]
            zeros=max(len(b),zeros)

        ans+=(8-zeros)
        break
    if(ans==0):
        ans=32
    print(ans)
    return







t= int(input())
t=1
for i in range(t):
    solve()

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

input:

4
10.0.0.1
10.0.0.24
10.0.0.8
10.0.0.16

output:


result: