QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#708891#2937. CIDRsefnuray#Compile Error//Python31.9kb2024-11-04 09:18:302024-11-04 09:18:31

Judging History

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

  • [2024-11-04 09:18:31]
  • 评测
  • [2024-11-04 09:18:30]
  • 提交

answer

std::vector<std::string> split(const std::string& s, const std::string& delimiter) {
    std::vector<std::string> tokens;
    size_t pos = 0;
    std::string token;
    while ((pos = s.find(delimiter)) != std::string::npos) {
        token = s.substr(0, pos);
        tokens.push_back(token);
        s.erase(0, pos + delimiter.length());
    }
    tokens.push_back(s);

    return tokens;
}

std::string s = "scott>=tiger>=mushroom";
std::string delimiter = ">=";

split(s, delimiter); // ["scott", "tiger", "mushroom"]
sk:3 — Today at 8:18 PM
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

  File "answer.code", line 19
    sk:3 — Today at 8:18 PM
         ^
SyntaxError: invalid character '—' (U+2014)