Submission #3635675


Source Code Expand

Copy
n,k=map(int,input().split())
c=0
s = k if k%2==1 else k//2
for i in range(s,n+1,s):
s2 = k if i%k==0 else s
n2 = (n-s2)//k+1
c+=n2**2
print(c)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
n,k=map(int,input().split())
c=0
s = k if k%2==1 else k//2
for i in range(s,n+1,s):
    s2 = k if i%k==0 else s
    n2 = (n-s2)//k+1
    c+=n2**2
print(c)

Submission Info

Submission Time
Task C - Triangular Relationship
User sei1tani
Language Python (3.4.3)
Score 300
Code Size 161 Byte
Status AC
Exec Time 150 ms
Memory 2940 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 18
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt, s4.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, s1.txt, s2.txt, s3.txt, s4.txt
Case Name Status Exec Time Memory
01.txt AC 150 ms 2940 KB
02.txt AC 148 ms 2940 KB
03.txt AC 63 ms 2940 KB
04.txt AC 19 ms 2940 KB
05.txt AC 19 ms 2940 KB
06.txt AC 19 ms 2940 KB
07.txt AC 19 ms 2940 KB
08.txt AC 18 ms 2940 KB
09.txt AC 18 ms 2940 KB
10.txt AC 36 ms 2940 KB
11.txt AC 21 ms 2940 KB
12.txt AC 29 ms 2940 KB
13.txt AC 18 ms 2940 KB
14.txt AC 19 ms 2940 KB
s1.txt AC 19 ms 2940 KB
s2.txt AC 19 ms 2940 KB
s3.txt AC 19 ms 2940 KB
s4.txt AC 19 ms 2940 KB


2025-03-27 (Thu)
08:53:23 +00:00