結果

問題 No.537 ユーザーID
ユーザー rocoder
提出日時 2017-08-21 11:37:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 344 ms / 2,000 ms
コード長 1,093 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-10-15 00:48:14
合計ジャッジ時間 5,523 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

# your code goes here
#537 userid
def f(s,t):
    if s==t:
        return 0
    elif s<t:
        return -1
    else:
        return 1
def bs(gs,D):
    l=len(D)
    j=0
    ts=1
    if l>0:
        p=1
        m=l//2
        j+=m
        ts=f(gs,D[j])
        while m>1 and ts!=0:
            if ts*p>0:
                l-=m+1
            else:
                l=m
            m=l//2
            if ts<0:
                j-=m+1
                p=-1
            else:
                j+=m+1
                p=1
            ts=f(gs,D[j])
        if ts*p>0:
            l-=m+1
        else:
            l=m
        if l==1 and ts!=0:
            j+=ts
            ts=f(gs,D[j])
    if ts!=0:
        if ts==-1:
            ts=0
        D.insert(j+ts,gs)
    return D        
    #    print(ts
N=int(input())
i=1
L=[]
while i*i<N:
    if N%i==0:
        i1=N//i
        k=["",""]
        k[0]=int(str(i)+str(i1))
        k[1]=int(str(i1)+str(i))
        for j in range(2):
            L=bs(k[j],L)
    i+=1
if i*i==N:
    k=int(str(i)+str(i))
    L=bs(k,L)
#c*=2
#if s==1:
 #   c-=1
print(len(L))
0