D
D
Dotamix2020-11-18 19:13:19
htaccess
Dotamix, 2020-11-18 19:13:19

Python task for the Olympiad does not pass on time?

a=list(input())
b=int(input())
if a.count(".")>0:
    del a[a.index(".")]
c=0.0
x=0
for i in range(len(a)):
    if i==0:
        c+=int(a[i])
    if i!=0:
        c+=(1/10**i)*int(a[i])
def check(a,b):
    while a!=0 and b!=0:
        if a > b:
            a%=b
        else:
            b%=a
    return a+b
    
i=1
while i <= b:
    g=1
    while g < i:
        if g/i<=c and check(g,i)==1:
            x+=1
        g+=1
    i+=1
print(x)

0 < a ≤ 1
2 ≤b ≤ 100000
Scored 82 points on the last tasks execution time 0.2-0.3 is beyond prompt.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Novikov, 2016-09-05
@BOOMER_74

More or less like this:

RewriteCond %{QUERY_STRING} ^.*newsid=[\d]+.*$
RewriteRule . /

D
Dotamix, 2020-11-18
@Dotamix

I must say right away that the very first cycle does not affect the speed, nothing changes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question