problem_id stringclasses 100
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 6 806 |
|---|---|---|---|
p02995 | s119049710 | Wrong Answer | a,b,c,d = map(int,input().split())
e = b - a
f = int(e/c)
g = int(e/d)
h = int(e/(c*d))
print(e-(f+g-h)) |
p02995 | s213625975 | Wrong Answer | import fractions
a,b,c,d = map(int, input().split())
x = (b//c - (a - 0.1)//c)
y = (b//d - (a - 0.1)//d)
z = (b//((c * d)//fractions.gcd(c,d)) - (a - 0.1)//((c * d)//fractions.gcd(c,d)))
print(int((b - a + 1) - (x + y - z)))
|
p02995 | s492703971 | Wrong Answer | import math
a,b,c,d=map(int,input().split())
x=b//c-a//c
y=b//d-a//d
g=math.gcd(c,d)
l=c*d//g
z=b//l-a//l
print(b-a+1-x-y+z) |
p02995 | s752207697 | Wrong Answer | from fractions import gcd
a, b, c, d = map(int, input().split())
def quo_items(x, num1, num2):
num1_quo = x // num1
num2_quo = x // num2
num12_quo = x // (num1 / gcd(num1, num2) * num2)
items = x - num1_quo - num2_quo + num12_quo
return items
print(quo_items(b, c, d) - quo_items(a - 1, c, d)) |
p02995 | s874067155 | Wrong Answer | a,b,c,d = map(int,input().split())
a_c = (a-1) // c
b_c = b // c
a_d = (a-1) // d
b_d = b // d
a_cd = (a-1) // (c*d)
b_cd = b // (c*d)
ans = (b-(a-1)) - (b_c - a_c) - (b_d - a_d) + (b_cd - a_cd)
print(ans) |
p02995 | s634839416 | Wrong Answer | import math
A,B,C,D = map(int, input().split())
a = math.floor(B / C) - math.floor((A-1) / C)
b = math.floor(B / D) - math.floor((A-1) / D)
c = math.floor(B / (C*D)) - math.floor((A-1) / (C*D))
s = a + b - c
ans = B - (A-1) - s
print(ans) |
p02995 | s487221479 | Wrong Answer | import math
A,B,C,D = list(map(int,input().split()))
def lcm(x, y):
return (x * y) // math.gcd(x, y)
CD = lcm(C,D)
CD1 = (A//CD +1)*CD
kyoutuu = (B-CD1)//CD
C1 = (A//C + 1)*C
Cnum = (B - C1)//C
D1 =(A//D +1)*D
Dnum = (B - D1)//D
print(B-A-Cnum-Dnum+kyoutuu) |
p02995 | s877972797 | Wrong Answer | import sys
input = sys.stdin.readline
def main():
A, B, C, D = map(int, input().split())
N = B-A+1
NC = (N+C-1)//C
ND = (N+D-1)//D
NCD = (N+C*D+1)//(C*D)
ans = N - NC - ND + NCD
print(N, NC, ND, NCD)
print(ans)
if __name__ == '__main__':
main() |
p02995 | s662148160 | Wrong Answer | A,B,C,D = map(int,input().split())
all_count = B-A
c_count = all_count//C
d_count = all_count//D
ans = all_count - c_count - d_count
print(ans) |
p02995 | s104622543 | Wrong Answer | A,B,C,D = map(int,input().split())
print(int(B // C - A // C + B // D - A // D + B // C*D - A // C*D )) |
p02995 | s604119861 | Wrong Answer | import math
A, B, C, D = map(int, input().split())
# CでもDでも割り切れない = 全体(a) - Cで割り切れる(b) + Dで割り切れる(c) + CでもDでも割り切れる(d)
lcm = C*D // math.gcd(C, D)
a = B-A+1
if A % C != 0 and B % C != 0: b = a // C
else: b = a // C + 1
if A % D != 0 and B % D != 0: c = a // D
else: c = a // D + 1
if A % lcm != 0 and B % lcm != 0: d = ... |
p02995 | s058441333 | Wrong Answer |
a, b, c, d = map(int, input().split())
ans_lt_b = b - (b // c + b // d - b // (c * d))
ans_lt_a = (a - 1) - (((a - 1) // c) + ((a - 1) // d) + ((a - 1) // (c * d)))
print(ans_lt_b - ans_lt_a)
|
p02995 | s859037711 | Wrong Answer | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def gcd(a, b):
# a,bの最大公約数D
while b:
a, b = b, a % b
return a
def lcm(a, b):
# a,bの最小公倍数
return a * b // gcd(a, b)
def main():
A, B, C, D = map(int, input().split())
all = B - A + 1
c = -(-all // C)
d = -(-all // D)
cd... |
p02995 | s265438040 | Wrong Answer | from fractions import gcd
a,b,c,d = map(int,input().split())
cab = (b//c)-((a-1)//c)
dab = (b//d)-((a-1)//c)
lcm = int(c*d/gcd(c,d))
cdab = (b//lcm)-((a-1)//lcm)
print((b-a+1)-cab-dab+cdab) |
p02995 | s711967174 | Wrong Answer | A, B, C, D = map(int, input().split())
def gcd(a, b):
if (b==0):
return a
else:
return gcd(b, a % b)
G = C * D // gcd(C, D)
ans_b = B - B//C - B//D + B//G
ans_a = A - A//C - A//D + A//G
print(ans_b - ans_a + 1) |
p02995 | s527097973 | Wrong Answer | A, B, C, D = map(int, input().split())
min = min(C, D)
max = max(C, D)
c=0
d=0
e=0
def gcd(max, min):
while min:
max, min = min, max%min
return max
lcm = max*min//gcd(max,min)
c = B//C-A//C
d = B//D-A//D
if lcm <= A:
e = B//lcm-(-(-A//lcm))
else:
e = B//lcm
print(c)
print(d)
print(e)
print(B-A+1-(c+d-e))
|
p02995 | s023425843 | Wrong Answer | import math
a,b,c,d = map(int, input().split())
print(b - ((b) // c + (b) // d - (b) // ( (c * d) // math.gcd(c,d) ) ))
print(a - (a // c + a // d - a // ( (c * d) // math.gcd(c,d) ) ))
print( (b - (b // c + b // d - (b // ( (c * d) // math.gcd(c , d) ) ) ) )
- (a - 1 - ((a-1) // c + (a-1) // d - ((a-1) // ( (c... |
p02995 | s248515050 | Wrong Answer | import fractions
a,b,c,d=map(int,input().split())
g=fractions.gcd(c,d)
l=(c*d)/g
print(b-a+1-int(b//c)+int((a-1)//c)-int(b//d)+int((a-1)//d)+int(b//l)-int((a-1)//l))
|
p02995 | s431524388 | Wrong Answer | import fractions
a,b,c,d=map(int,input().split())
g=fractions.gcd(c,d)
l=(c*d)/g
print(b-a+1-int(b//c)+int((a-1)//c)-int(b//d)+int((a-1)//d)+int(b//l)-int((a-1)//l))
|
p02995 | s618845824 | Wrong Answer | import fractions
a,b,c,d=map(int,input().split())
g=fractions.gcd(c,d)
l=int(c*d/g)
x=b-a
cd=x//c
dd=x/d
ld=x//l
r=int(x-(cd+dd-ld))
print(r) |
p02995 | s604457599 | Wrong Answer |
import fractions
def anti_division(a, b, c, d):
ans = b-a+1
cd = a*b // fractions.gcd(a, b)
ccount = ((b+c)//c) - ((a+c)//c)
dcount = ((b+d)//d) - ((a+d)//d)
cdcount = ((b+cd)//cd) - ((a+cd)//cd)
return ans-ccount-dcount+cdcount
def main():
a, b, c, d = map(int, input().split())
print(... |
p02995 | s499406580 | Wrong Answer | # AtCoder Beginner Contest 131
# C - Anti-Division
import math
def lcm(x, y):
return (x * y) // math.gcd(x, y)
A,B,C,D=map(int,input().split())
bc=B//C
ac=A//C
cnum=bc-ac
bd=B//D
ad=A//D
dnum=bd-ad
lcmcd=lcm(C,D)
blcmcd=B//lcmcd
alcmcd=A//lcmcd
lcmcdnum=blcmcd-alcmcd
if lcm(C,D)==C*D:
print(B-A-cnum-dnum... |
p02995 | s204609686 | Wrong Answer | a,b,c,d=map(int,input().split())
zen=a-1
ack=int(zen//c)
adk=int(zen//d)
acdk=int(zen//(c*d))
aans=zen-ack-adk+acdk
ck=int(b//c)
dk=int(b//d)
cdk=int(b//(c*d))
ans=b-ck-dk+cdk
ans=ans-aans
print(ans) |
p02995 | s904439227 | Wrong Answer | import fractions
a,b,c,d = map(int,input().split())
l = (c*d)//fractions.gcd(c,d)
if fractions.gcd(c,d) == 1:
l = 10**18+1
num =((a//c)+(a//d))-(a//l)- (a//(c*d))
num2 =((b//c)+(b//d))-(b//l)-(b//(c*d))
print(b-a-(num2-num))
else:
num =((a//c)+(a//d))-(a//l)- (a//(c*d))
num2 =((b//c)+(b//d))-(b//l)-(b//(c*d))-1
... |
p02995 | s158451966 | Wrong Answer | import math
a,b,c,d = map(int,input().split())
e = int(c*d/math.gcd(c,d))
wa = 0
c_seki = int(b/c)-int((a-1)/c)
d_seki = int(b/d)-int((a-1)/d)
e_seki = int(b/e)-int((a-1)/e)
wa = c_seki+d_seki-e_seki
print(b-a+1-wa,c_seki,d_seki,e_seki) |
p02995 | s878027628 | Wrong Answer | a, b, c, d = map(int, input().split())
print((b-a+1) - (b//c + b//d - b//(c*d)) + ((a-1)//c + (a-1)//d - (a-1)//(c*d))) |
p02995 | s136953955 | Wrong Answer | # https://atcoder.jp/contests/abc131/tasks/abc131_c
from fractions import gcd
A, B, C, D = map(int, input().split())
C_ = (B // C) - ((A - 1) // C)
D_ = (B // D) - ((A - 1) // D)
# 最大公約数
CD = gcd(C, D)
# 最小公倍数
CD = (C * D) / CD
CD_ = (B // CD) - ((A - 1) // CD)
total_num = B - (A - 1)
ans = total_num - C_ - D... |
p02995 | s307874756 | Wrong Answer | import fractions
def lcm(x,y):
return (x * y) // fractions.gcd(x,y)
A,B,C,D = map(int,input().split())
cnt = 0
cnt += ((B // C) - ((A-1) // C))
cnt += ((B // D) - ((A-1) // D))
tmp = 0
tmp = ((B//lcm(C,D)) - (A//lcm(C,D)))
print(B-A+1-cnt+tmp)
|
p02995 | s847445219 | Wrong Answer | import fractions
a,b,c,d= map(int,input().split())
n = b-a+1#要素数
j = b//c + b//d - (a-1)//c - (a-1)//d#a~bの範囲でcで割りきれる数とdで割り切れる数の合計
lcm =(c*d) / fractions.gcd(c,d)#c,dの最小公倍数
print(int(n-j-(b//lcm-(a-1)//lcm))) |
p02995 | s132057035 | Wrong Answer | from math import ceil
from fractions import gcd
a, b, c, d = map(int, input().split())
cd_lcm = c*d//gcd(c, d)
c_left, c_right = ceil(a/c), b//c
d_left, d_right = ceil(a/d), b//d
cd_left, cd_right = ceil(a/cd_lcm), b//(cd_lcm)
cv, dv, cdv = c_right - c_left + 1, d_right - d_left + 1, cd_right - cd_left + 1
print((b - ... |
p02995 | s802969839 | Wrong Answer | import fractions
a, b, c, d = map(int, input().split())
print((b-a+1)-(((b//c)+(b//d))-(((a-1)//c)+((a-1)//d))-(b//(c*d//fractions.gcd(c,d))+((a-1)//(c*d//fractions.gcd(c,d)))))) |
p02995 | s779165427 | Wrong Answer | import fractions
a,b,c,d= map(int,input().split())
x = (b//c)-(a//c)
y = (b//d)-(a//d)
lcm = (c*d)//fractions.gcd(c,d)
z = (b//lcm)-(a//lcm)
print(b-a-x-y+z+1) |
p02995 | s896408594 | Wrong Answer | from fractions import gcd
a, b, c, d = map(int, input().split())
lcm = c * d / gcd(c, d)
def solve(n, lcm):
res = n - n // c - n // d + n // lcm
return res
print(int(solve(b, lcm) - solve(a-1, lcm))) |
p02995 | s964770452 | Wrong Answer | import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().spl... |
p02995 | s250654628 | Wrong Answer | import math
a,b,c,d=map(int,input().split())
count=b-a+1
acou=((a-1)//c)+((a-1)//d)-int(((a-1)//(c*d/math.gcd(c,d))))
bcou=(b//c)+(b//d)-int((b//(c*d/math.gcd(c,d))))
print(count-(bcou-acou)) |
p02995 | s106963016 | Wrong Answer | import itertools as it
import collections as col
import fractions
from functools import reduce
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
a,b,c,d=map(int,input().split())
n=b-a
print(n - ((n//c) + (n//d)) + (n//(lcm(c,d))))
|
p02995 | s917517846 | Wrong Answer | import math
a,b,c,d = map(int, input().split())
C, D = c, d
if C < D:
C, D = D, C
r = C % D
while r > 0:
C = D
D = r
r = C % D
lcm = c * d // D
cPower = b//c - math.ceil(a/c) + 1
dPower = b//d - math.ceil(a/d) + 1
cdPower = b//lcm - a//lcm
print((b-a+1) - cPower - dPower + cdPower) |
p02995 | s486868316 | Wrong Answer | from fractions import gcd
def lcm(x, y):
return (x * y) // gcd(x, y)
A, B, C, D = map(int, input().split())
print(B - A + 1 - (B // C - (A - 1) // C + B // D - (A - 1) // D - (B // (lcm(C, D) - (A - 1) // lcm(C, D)))))
|
p02995 | s334620962 | Wrong Answer | import sys
sys.setrecursionlimit(10 ** 9)
def gcd(a, b):
if a < b:
a, b = b, a
if a % b == 0:
return b
else:
return gcd(b, a // b)
a, b, c, d = map(int, input().split())
divc = b // c - a // c
if a % c == 0:
divc += 1
divd = b // d - a // d
if a % d == 0:
divd += 1
... |
p02995 | s744844926 | Wrong Answer | a,b,c,d=map(int,input().split())
cnt_a=a-a//c-a//d+a//(c*d)
cnt_b=b-b//c-b//d+b//(c*d)
if a%c==0 or a%d==0:
print(cnt_b-cnt_a)
else:
print(cnt_b-cnt_a+1) |
p02995 | s694678499 | Wrong Answer | def gcd(c, d):
if c <= d:
c, d = d, c
while c % d:
c, d = d, c % d
return d
def lcm(c, d):
return (c * d) // gcd(c, d)
A, B, C, D = map(int, input().split())
c_or_d = (B // C - A // C) + (B // D - A // D) -(B // lcm(C, D) - A // lcm(C, D))
print(B - A + 1 - c_or_d)
|
p02995 | s204497514 | Wrong Answer | #入力:N,M(int:整数)
def input2():
return map(int,input().split())
a,b,c,d=input2()
c_len=b//c #b以下のcの倍数の個数
d_len=b//d #b以下のdの倍数の個数
all_len=b//(c*d) #重複
ans=b-(c_len+d_len)+all_len
a-=1
ans= ans- (a-(a//c+a//d)+a//(c*d))
print(ans) |
p02995 | s166242765 | Wrong Answer | import fractions
def lcm(a, b):
return (a * b) // fractions.gcd(a, b)
A, B, C, D = map(int, input().split())
#間の数の個数
num = B - A + 1
CD = lcm(C, D)
c = int(num/C)
if num%C != 0 and (num%C > A%C or num%C > (C-A%C)):
c += 1
d = int(num/D)
if num%D != 0 and (num%D > A%D or num%D > (D-A%D)):
d += 1
cd ... |
p02995 | s005503024 | Wrong Answer | a,b,c,d = map(int, input().split())
c1, d1, cd1 = b // c, b // d, b // (c*d)
c2, d2, cd2 = (a-1) // c, (a-1) // d, a // (c*d)
ans = (c1+d1-cd1) - (c2+d2-cd2)
print(ans)
print((b-a+1) - ans) |
p02995 | s977515883 | Wrong Answer | A,B,C,D=map(int,input().split())
nc=int(B/C)-int((A-1)/C)
nd=int(B/D)-int((A-1)/D)
ncd=int(B/(C*D))-int((A-1)/(C*D))
print(B-A+1-nc-nd+ncd) |
p02995 | s492131382 | Wrong Answer | A,B,C,D=map(int,input().split())
Cnum=B//C-(A-1)//C
Dnum=B//D-(A-1)//D
CDnum=B//(C*D)-(A-1)//(C*D)
print(B-A+1-Cnum-Dnum+CDnum) |
p02995 | s790689259 | Wrong Answer | import math
A,B,C,D=map(int,input().split())
c=(int((B-B%C)-(A-1+C-(A-1)%C))/C)+1
d=(int((B-B%D)-(A-1+D-(A-1)%D))/D)+1
lcm=C*D/math.gcd(C,D)
candd=((B-B%lcm)-(A-1+lcm-(A-1)%lcm))/lcm+1
print(int(B-A+1-c-d+candd)) |
p02995 | s847759642 | Wrong Answer | import math
def gcd(a,b):
if b == 0:
return a
else:
return gcd(b, a%b)
A, B, C, D = map(int, input().split())
count = 0
BCcount = math.floor(B / C)
BDcount = math.floor(B / D)
ACcount = math.floor((A - 1) / C)
ADcount = math.floor((A - 1) / D)
l = C * D / gcd(C, D)
BCDcount = math.floor(B / l)
ACDcount = ... |
p02995 | s844244682 | Wrong Answer | def abc131c_anti_division():
import math
cnt = 0
a, b, c, d = map(int, input().split())
cnt = b//c - math.ceil(a/c) + 1
cnt += b//d - math.ceil(a/d) + 1
e = (c*d)//math.gcd(c, d)
cnt -= (b // e - math.ceil(a / e) + 1)
print(int(b-a+1-cnt))
abc131c_anti_division() |
p02995 | s044902314 | Wrong Answer | import math
k = input().split()
a = int(k[0])
b = int(k[1])
c = int(k[2])
d = int(k[3])
CUpLimited = a/c
CDownLimited = b/c
DUpLimited = a/d
DDownLimited = b/d
# print((CDownLimited-CUpLimited))
# print((DDownLimited-DUpLimited))
Counter = b - a - int(CDownLimited-CUpLimited) - int(DDownLimited-DUpLimited)
print(mat... |
p02995 | s339481868 | Wrong Answer | a,b,c,d = map(int, input().split())
import fractions
lcmcd = a * b // fractions.gcd(c,d)
bc = b // c
ac = a // c
bd = b // d
ad = a // d
blcmcd = b // lcmcd
alcmcd = a // lcmcd
if a % c != 0:
ac += 1
if a % d != 0:
ad += 1
if a % lcmcd != 0:
alcmcd += 1
print((b - a + 1) + 1 - ((bc - ac + 1) + (bd - ad +... |
p02995 | s321060490 | Wrong Answer | import numpy as np
import fractions
gcd = fractions.gcd
def main():
#n = int(input())
a,b,c,d = map( int, input().split())
c_baisuu = int(b/c)-int((a-1)/c)
d_baisuu = int(b/d)-int((a-1)/d)
cd = int(c * d / gcd(c, d))
cd_baisuu = int(b/(cd))-int((a-1)/(cd))
zenbu = b-a+1
print(zenbu-(c... |
p02995 | s252524611 | Wrong Answer | a,b,c,d = map(int,input().split())
count = (b-(b//c+b//d-b//(c*d))) - ((a-1)-((a-1)//c+(a-1)//d-(a-1)//(c*d)))
print(count) |
p02995 | s144483598 | Wrong Answer | a,b,c,d=map(int, input().split())
a-=1
tc = b//c-a//c
td = b//d-a//d
tcd = b//(c*d)-a//(c*d)
print(b-a-tc-td+tcd) |
p02995 | s130639411 | Wrong Answer | def main():
def gcd(a,b):
while b!=0:
a,b=b,a%b
return a
def lcm(a, b):
return (a * b)//gcd(a,b)
A,B,C,D = map(int,input().split())
minus = B-A
print(minus-(minus//C+minus//D-(minus//(lcm(C,D)))))
if __name__=="__main__":
main() |
p02995 | s452328331 | Wrong Answer | import math
def lcm(x, y):
return (x * y) // math.gcd(x, y)
A,B,C,D = list(map(int,input().split()))
num_C_bai = ((B-(B%C) - (A-(A%C)+C)))//C + 1
num_D_bai = ((B-(B%D) - (A-(A%D)+D)))//D + 1
E = lcm(C,D)
num_E_bai = ((B-(B%E) - (A-(A%E)+E)))//E + 1
print(B + 1 - A - num_C_bai - num_D_bai + num_E_bai)
|
p02995 | s690241920 | Wrong Answer | import math
a,b,c,d = map(int,input().split())
e = c*d//math.gcd(c,d)
print(b-a+1 + (math.floor(b/e)-(math.ceil(a/e))+1)-(math.floor(b/c)-(math.ceil(a/c))+1)-(math.floor(b/d)-(math.ceil(a/d))+1))
|
p02995 | s874515526 | Wrong Answer | A,B,C,D = map(int,input().split())
S = B-A+1
C_count = S//C
D_count = S//D
both_count = S//(C*D)
hani = C_count + D_count - both_count
print(S-hani) |
p02995 | s473148468 | Wrong Answer | a,b,c,d = map(int,input().split())
|
p02995 | s337716156 | Wrong Answer | import math
a,b,c,d = map(int, input().split())
lcm = int(c*d / math.gcd(c,d))
def num(i):
ans = int(b/i) - int(a/i)
if a % i == 0:
ans +=1
return ans
lcm_num = num(lcm)
cd_num = num(c) + num(d)
num = cd_num - lcm_num
print(b-a+1-num) |
p02995 | s193159251 | Wrong Answer | import math
a, b, c, d = map(int, input().split())
lcm = c*d / math.gcd(c, d)
num = b-a
c_1 = (b-a)//c
d_1 = (b-a)//d
cd_1 = (b-a)//(lcm)
ans = num - (c_1 + d_1) + cd_1
print(int(ans)) |
p02995 | s675656068 | Wrong Answer | from fractions import gcd
a,b,c,d=map(int,input().split())
def lcm(a, b):
return a * b // gcd (a, b)
i_max=b//c
j_max=b//d
k_max=b//lcm(c,d)
i_min=a//c
j_min=a//d
k_min=a//lcm(c,d)
i=i_max-i_min
j=j_max-j_min
k=k_max-k_min
print(b-a+1-(i+j-k))
|
p02995 | s349926472 | Wrong Answer | def main():
def gcd(a,b):
while b!=0:
a,b=b,a%b
return a
def lcm(a, b):
return (a * b)//gcd(a,b)
A,B,C,D = map(int,input().split())
minus = B-A+1
print(minus-(minus//C+minus//D-(minus//(lcm(C,D)))))
if __name__=="__main__":
main() |
p02995 | s799508547 | Wrong Answer | #数I
A,B,C,D = map(int,input().split())
S = B-A+1
print(S-(S//C + S//D - S//(C*D))) |
p02995 | s995563471 | Wrong Answer | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
A, B, C, D = map(int, input().split())
all = B - A + 1
c = -(-(B - A) // C)
d = -(-(B - A) // D)
cd = -(-(B - A) // (C * D))
print(all - c - d + cd)
if __name__ == "__main__":
main()
|
p02995 | s999924397 | Wrong Answer | A, B , C , D = map(int, input().split())
count= 0
bc = B // C
bd = B // D
bcd = B //(C*D)
can = bc + bd - bcd
ans = B - can
ac = (A-1) // C
ad = (A-1) // D
acd = (A-1) //(C*D)
can2= ac + ad - acd
ans = ans - ((A-1) - can2)
print(ans) |
p02995 | s234604390 | Wrong Answer | from math import ceil, floor
from fractions import gcd
A, B, C, D = map(int, input().split())
def div_count(div):
#return floor(B/div) - ceil(A/div) + 1
return B//div - A//div + 1
div_c = div_count(C)
div_d = div_count(D)
lcm = C * D // gcd(C, D)
div_cd = div_count(lcm)
print((B - A + 1) - (div_c + div_d - div_... |
p02995 | s583939328 | Wrong Answer | import fractions
A,B,C,D = map(int,input().split())
g = C * D // fractions.gcd(C,D)
# A以下
cntA = 0
cntA += A // C
cntA += A // D
cntA -= A // g
# B未満
cntB = 0
cntB += (B-1) // C
cntB += (B-1) // D
cntB -= (B-1) // g
cnt = cntA - cntB
cnt = (A - B + 1) - cnt
print(cnt)
|
p02995 | s146632190 | Wrong Answer | import math
a,b,c,d = map(int,input().split())
s1=b//c - a//c
s2=b//d - a//d
s12=int( b//(c*d/math.gcd(c,d)) - a//(c*d/math.gcd(c,d)) )
print(b-a+1-(s1+s2-s12))
|
p02995 | s233424241 | Wrong Answer | import sys
input = sys.stdin.readline
import fractions
def main():
A, B, C, D = list(map(int, input().split()))
Aone = A - 1
lcm = int(C / fractions.gcd(C, D) * D)
Bc = int(B / C)
Bd = int(B / D)
Blcm = int(B / lcm)
Bdec = B - Bc - Bd + Blcm
# print(Bc,Bd,Blcm)
Ac = int(Aone / C)
... |
p02995 | s101133294 | Wrong Answer | a,b,c,d = map(int,input().split())
ans = 0
for i in range(a,b+1):
if(i%c!=0)and(i%d!=0):
ans += 1 |
p02995 | s794129552 | Wrong Answer | a,b,c,d = map(int,input().split())
n = b-a-1
n_c = n//c
n_d = n//d
n_gap = n//(c*d)
print(n-n_c-n_d+n_gap+1) |
p02995 | s690265814 | Wrong Answer | import fractions
a,b,c,d=map(int,input().split())
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
ans=b//d + b//c - (a-1)//c - (a-1)//d - b//lcm(c,d) - (a-1)//lcm(c,d)
ans=b-a+1-ans
print(ans) |
p02995 | s758959402 | Wrong Answer | import math
a, b, c, d = map(int, input().split())
lcm_cd = c * d // math.gcd(c, d)
ans_lt_b = b - (b // c + b // d - b // lcm_cd)
ans_lt_a = (a - 1) - (((a - 1) // c) + ((a - 1) // d) + ((a - 1) // lcm_cd))
print(ans_lt_b - ans_lt_a)
|
p02995 | s216090414 | Wrong Answer | import math
def lcm(x, y):
return (x * y) // math.gcd(x, y)
a,b,c,d=map(int,input().split())
c_div=math.floor(b/c)-math.ceil(a/c)+1
d_div=math.floor(b/d)-math.ceil(a/d)+1
cd_div=math.floor(b/lcm(c,d))-math.ceil(a/lcm(c,d))+1
ans=(b-a+1)-((c_div)+(d_div)-(cd_div))
print(ans) |
p02995 | s959573228 | Wrong Answer | a,b,c,d = map(int,input().split())
e = c*d
h = b-a+1
print(h//c+h//d+h//e) |
p02995 | s569991052 | Wrong Answer | a,b,c,d=map(int,input().split())
def div(x,y):
return y//x
def div2(x):
return div(x,b)-div(x,a)
print(b-a+1-div2(c)-div2(d)+div2(c*d)) |
p02995 | s198209493 | Wrong Answer | A,B,C,D = map(int,input().split())
count = 0
for i in range(A,B+1):
if i%C != 0 and i%D != 0:
count += 1
i += 1
else:
i += 1
break
print(count) |
p02995 | s503352092 | Wrong Answer | import math
a,b,c,d = map(int,input().split())
s1=b//c - (a-1)//c
s2=b//d - (a-1)//d
s12=int( b//(c*d/math.gcd(c,d)) - (a-1)//(c*d/math.gcd(c,d)) )
print(b-a+1-(s1+s2-s12))
|
p02995 | s674473204 | Wrong Answer | import fractions
a,b,c,d=map(int, input().split())
cdlcm= a*b//fractions.gcd(a,b)
a-=1
tc = b//c-a//c
td = b//d-a//d
tlcm = b//cdlcm-a//cdlcm
print(b-a-tc-td+tlcm) |
p02995 | s097460173 | Wrong Answer | a,b,c,d = map(int, input().split())
count = 0
#最大公約数
def gcd(a,b):
while b!=0:
a,b = b,a%b
return a
#最小公倍数
def lcm(a,b):
return a*b // gcd(a,b)
gcd_num = lcm(c,d)
#a
a_count = a // c
a_count = a_count + (a//d)
a_count = a_count - (a//gcd_num)
a_count = a-a_count
#b
b_count = b // c
b_count = b_... |
p02995 | s365995023 | Wrong Answer | from fractions import gcd
a, b, c, d = map(int,input().split())
if a%c == 0:
c_number = b // c - a // c + 1
else:
c_number = b // c - a // c
if a%d == 0:
d_number = b // d - a // d + 1
else:
d_number = b // d - a // d
if a%(c*d) == 0:
cd_number = b // (c*d / gcd(c,d)) - a // (c*d / gcd(c,d)) + 1
e... |
p02995 | s618920518 | Wrong Answer | from fractions import gcd
A, B, C, D = map(int, input().split())
c_div = B//C - (A-1)//C
d_div = B//D - (A-1)//D
g = C*D // gcd(C, D)
cd_div = B//g - (A-1)//g
tot = B - A + 1
print(tot - c_div - d_div + cd_div)
print(tot, c_div, d_div, cd_div) |
p02995 | s938485923 | Wrong Answer | a,b,c,d=map(int,input().split())
base=b-a+1
n_c=b//c-(a+c-1)//c+1
n_d=b//d-(a+d-1)//d+1
cd=c*d
n_cd=b//cd-(a+cd-1)//cd+1
print(base-n_c-n_d+n_cd)
|
p02995 | s483771260 | Wrong Answer | a,b,c,d=map(int,input().split())
print(b-a+1-(b//c+b//d-b//(c*d)+a//c+a//d-a//(c*d))) |
p02995 | s815158748 | Wrong Answer | import fractions
from functools import reduce
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
A, B, C, D = map(int, input().split())
ans_b = B - int(B / C) - int(B / D) + int(B... |
p02995 | s261604056 | Wrong Answer | import fractions
A, B, C, D = map(int, input().split())
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
LCM_CD = lcm(C, D)
C_Count = B // C - A // C
D_Count = B // D - A // D
CD_Count = B // (LCM_CD) - A // (LCM_CD)
print(B - A + 1 - C_Count - D_Count + CD_Count)
|
p02995 | s053017624 | Wrong Answer | import math
a,b,c,d = map(int, input().split())
lcm = c*d / math.gcd(c,d)
def num(i):
ans = b//i - a//i
if a % i == 0:
ans +=1
return ans
lcm_num = num(lcm)
cd_num = num(c) + num(d)
num = cd_num - lcm_num
print(b-a+1-num) |
p02995 | s483436180 | Wrong Answer | import math
a,b,c,d=map(int,input().split())
print(a) |
p02995 | s240469064 | Wrong Answer | from fractions import gcd
a,b,c,d = map(int,input().split())
count = (b-(b//c+b//d-b//(c*d/gcd(c,d)))) - ((a-1)-((a-1)//c+(a-1)//d-(a-1)//(c*d/gcd(c,d))))
print(int(count)) |
p02995 | s699393161 | Wrong Answer | from math import gcd, ceil
a, b, c, d = map(int, input().split())
lcm = c * d // gcd(c, d)
ans = (b-a+1 - ceil((b-a+1)/c) - ceil((b-a+1)/d) + ceil((b-a+1)/lcm))
print(ans) |
p02995 | s599098543 | Wrong Answer | # AtCoder Beginner Contest 131
# C - Anti-Division
import math
def lcm(x, y):
return (x * y) // math.gcd(x, y)
A,B,C,D=map(int,input().split())
bc=B//C
ac=A//C
cnum=bc-ac
bd=B//D
ad=A//D
dnum=bd-ad
lcmcd=lcm(C,D)
blcmcd=B//lcmcd
alcmcd=A//lcmcd
lcmcdnum=blcmcd-alcmcd
print(B-A-cnum-dnum+lcmcdnum) |
p02995 | s459476694 | Wrong Answer | #abc133 c
from fractions import gcd
a,b,c,d=map(int,input().split())
"""
def gcd(x,y):
if y==1:
return x
return gcd(y,x%y)
"""
def lcm(x,y):
return (x*y)//gcd(x,y)
e=lcm(c,d) #c,dの最小公倍数
def kosu(num):
z=num
nc=int(num/c)
nd=int(num/d)
ne=int(num/e)
return z-nc-nd+ne
ans=kosu(... |
p02995 | s419726868 | Wrong Answer | a, b, c, d = map(int, input().split())
print(a,b,c,d)
from fractions import gcd
lcm = c * d / gcd(c, d)
print(lcm)
num = 0
for i in range(a, b+1):
if i % c == 0:
num += 1
if i % d == 0:
num += 1
if i % lcm == 0:
num -= 1
print(b - a + 1 - num) |
p02995 | s467999825 | Wrong Answer | import math
def gcd(a,b):
if a==0:
return b
else:
return gcd(b%a,a)
def lcm(a,b):
return (a*b)/gcd(a,b)
def main():
a ,b,c,d = map(int,input().split())
lc = lcm(c,d)
cnt = (math.floor((b)/c)-math.floor((a)/c))+(math.floor((b)/d)-math.floor((a)/d))- (math.floor((b)/(lc))-math.floor((a)/(lc)))
print((b-(a-1))... |
p02995 | s150146203 | Wrong Answer | from math import gcd
A, B, C, D = map(int, input().split())
E = C*D//gcd(C, D)
ans = B-A+1 - (B//C-(A-1)//C + B//D-(A-1)//D - B//E-(A-1)//E)
print(ans) |
p02995 | s073272020 | Wrong Answer | def resolve():
from fractions import gcd
a, b, c, d = map(int, input().split())
e = int(c*d/gcd(c,d))
db = int(b - (int(b/c) + int(b/d) - int(b/e)))
da = int((a-1) - (int((a-1)/c) + int((a-1)/d) - int((a-1)/e)))
print(int(db-da))
|
p02995 | s240671120 | Wrong Answer | from math import gcd
a, b, c, d = map(int,input().split())
if a % c ==0:
c_explicit = b // c - a // c + 1
else:
c_explicit = b // c - a // c
if a % d ==0:
d_explicit = b // d - a // d + 1
else:
d_explicit = b // d - a // d
e = gcd(c, d)
gcl = (c / e) * (d / e) * e
if a % gcl ==0:
e_explicit = b //... |
p02995 | s536398940 | Wrong Answer | A,B,C,D=map(int,input().split())
a=(B//C)-(A//C)
b=(B//D)-(A//D)
c=(B//(C+D))-(A//(C+D))
print(B-A-a-b+c) |
p02995 | s327425377 | Wrong Answer | from math import gcd
a, b, c, d = map(int, input().split())
x = (b // c) - ((a-1) // c)
y = (b // d) - ((a-1) // d)
z = (b // gcd(c, d)) - ((a-1) // gcd(c, d))
print(b-a+1-(x+y-z)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.