s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s845423054
p00746
u931913851
1561629761
Python
Python3
py
Accepted
80
5652
1,049
"角角画伯,かく悩みき" # それぞれの座標を記録していく(一度設置したタイルの座標が変わることはない) while True: N = int(input()) if N == 0: break tile_coodinates = {} tile_coodinates[0] = (0, 0) for i in range(1, N): n, d = map(int, input().split()) if d == 0: tile_coodinates[i] = (tile_coodinates[n][0]-1, t...
p00746
<h1><font color="#000000">Problem A:</font> Pablo Squarson's Headache</h1> <!-- begin en only --> <p>Pablo Squarson is a well-known cubism artist. This year's theme for Pablo Squarson is "Squares". Today we are visiting his studio to see how his masterpieces are given birth.</p> <!-- end en only --> <!-- begin...
1 5 0 0 0 1 0 2 0 3 12 0 0 1 0 2 0 3 1 4 1 5 1 6 2 7 2 8 2 9 3 10 3 10 0 2 1 2 2 2 3 2 2 1 5 1 6 1 7 1 8 1 0
1 1 3 3 4 4 5 6
24,796
s990337997
p00746
u215870135
1561288944
Python
Python3
py
Accepted
80
5616
629
while True: N = int(input()) if N == 0: break min_w = 0 max_w = 0 min_h = 0 max_h = 0 points = [[0, 0]] for i in range(N-1): n, d = map(int, input().split()) w = points[n][0] h = points[n][1] if d == 0: w -= 1 min_w = min(mi...
p00746
<h1><font color="#000000">Problem A:</font> Pablo Squarson's Headache</h1> <!-- begin en only --> <p>Pablo Squarson is a well-known cubism artist. This year's theme for Pablo Squarson is "Squares". Today we are visiting his studio to see how his masterpieces are given birth.</p> <!-- end en only --> <!-- begin...
1 5 0 0 0 1 0 2 0 3 12 0 0 1 0 2 0 3 1 4 1 5 1 6 2 7 2 8 2 9 3 10 3 10 0 2 1 2 2 2 3 2 2 1 5 1 6 1 7 1 8 1 0
1 1 3 3 4 4 5 6
24,797
s775623505
p00746
u788553535
1561177357
Python
Python3
py
Accepted
90
6340
476
""" 5 0 0 0 1 0 2 0 3 """ import copy while True: N = int(input()) if N==0: break T = [[0,0]] for i in range(N-1): n,d = map(int,input().split()) S = copy.copy(T[n]) if d==0: S[0] = S[0]-1 elif d==1: S[1] = S[1]-1 elif d==2: S[0] = S[0]+1 else: S[1] = S[1]+1 ...
p00746
<h1><font color="#000000">Problem A:</font> Pablo Squarson's Headache</h1> <!-- begin en only --> <p>Pablo Squarson is a well-known cubism artist. This year's theme for Pablo Squarson is "Squares". Today we are visiting his studio to see how his masterpieces are given birth.</p> <!-- end en only --> <!-- begin...
1 5 0 0 0 1 0 2 0 3 12 0 0 1 0 2 0 3 1 4 1 5 1 6 2 7 2 8 2 9 3 10 3 10 0 2 1 2 2 2 3 2 2 1 5 1 6 1 7 1 8 1 0
1 1 3 3 4 4 5 6
24,798
s237855860
p00746
u158979022
1560388217
Python
Python3
py
Accepted
70
5624
591
while True: N = int(input()) if N==0: break squa = [[0,0]] xmax, xmin, ymax, ymin = 0, 0, 0, 0 for i in range(N-1): n, d = map(int, input().split()) if d==0: squa.append([squa[n][0]-1, squa[n][1]]) xmin = min(xmin, squa[n][0]-1) elif d==1: squa.append([squa[n][0], squa[n][1]-...
p00746
<h1><font color="#000000">Problem A:</font> Pablo Squarson's Headache</h1> <!-- begin en only --> <p>Pablo Squarson is a well-known cubism artist. This year's theme for Pablo Squarson is "Squares". Today we are visiting his studio to see how his masterpieces are given birth.</p> <!-- end en only --> <!-- begin...
1 5 0 0 0 1 0 2 0 3 12 0 0 1 0 2 0 3 1 4 1 5 1 6 2 7 2 8 2 9 3 10 3 10 0 2 1 2 2 2 3 2 2 1 5 1 6 1 7 1 8 1 0
1 1 3 3 4 4 5 6
24,799
s517106443
p00746
u046108504
1558491622
Python
Python3
py
Accepted
80
5632
916
if __name__ == "__main__": while True: N = int(input()) if N == 0: break # 左, 下, 右, 上 wak = {0: [0, 0]} ml = float("inf") md = float("inf") mr = -float("inf") mu = -float("inf") for i in range(1, N): n, d = map(int, inpu...
p00746
<h1><font color="#000000">Problem A:</font> Pablo Squarson's Headache</h1> <!-- begin en only --> <p>Pablo Squarson is a well-known cubism artist. This year's theme for Pablo Squarson is "Squares". Today we are visiting his studio to see how his masterpieces are given birth.</p> <!-- end en only --> <!-- begin...
1 5 0 0 0 1 0 2 0 3 12 0 0 1 0 2 0 3 1 4 1 5 1 6 2 7 2 8 2 9 3 10 3 10 0 2 1 2 2 2 3 2 2 1 5 1 6 1 7 1 8 1 0
1 1 3 3 4 4 5 6
24,800
s249623484
p00746
u701749469
1556287325
Python
Python3
py
Accepted
70
5624
841
def main(): while True: sq_sum = int(input()) if sq_sum == 0: break abs_list = [[0, 0]] for i in range(sq_sum - 1): n, d = map(int, input().split()) abs_list.append(abs_p(abs_list, n, d)) xlist = [] ylist = [] for i in range(le...
p00746
<h1><font color="#000000">Problem A:</font> Pablo Squarson's Headache</h1> <!-- begin en only --> <p>Pablo Squarson is a well-known cubism artist. This year's theme for Pablo Squarson is "Squares". Today we are visiting his studio to see how his masterpieces are given birth.</p> <!-- end en only --> <!-- begin...
1 5 0 0 0 1 0 2 0 3 12 0 0 1 0 2 0 3 1 4 1 5 1 6 2 7 2 8 2 9 3 10 3 10 0 2 1 2 2 2 3 2 2 1 5 1 6 1 7 1 8 1 0
1 1 3 3 4 4 5 6
24,801
s707533189
p00746
u990228206
1554806663
Python
Python3
py
Accepted
70
5628
614
while 1: N=int(input()) if N==0:break tile=[[0,0]] xma,xmi,yma,ymi=0,0,0,0 for i in range(N-1): n,d=map(int,input().split()) if d==0: tile.append([tile[n][0]-1,tile[n][1]]) xmi=min(xmi,tile[n][0]-1) elif d==1: tile.append([tile[n][0],tile[n...
p00746
<h1><font color="#000000">Problem A:</font> Pablo Squarson's Headache</h1> <!-- begin en only --> <p>Pablo Squarson is a well-known cubism artist. This year's theme for Pablo Squarson is "Squares". Today we are visiting his studio to see how his masterpieces are given birth.</p> <!-- end en only --> <!-- begin...
1 5 0 0 0 1 0 2 0 3 12 0 0 1 0 2 0 3 1 4 1 5 1 6 2 7 2 8 2 9 3 10 3 10 0 2 1 2 2 2 3 2 2 1 5 1 6 1 7 1 8 1 0
1 1 3 3 4 4 5 6
24,802
s181983630
p00746
u763386533
1554794066
Python
Python3
py
Accepted
80
5628
836
n=int(input()) while n!=0: stack_x=[0] stack_y=[0] position=[[0,0] for i in range(n)] for i in range(1,n): x,y=map(int,input().split()) if y==1: position[i][0]=position[x][0] position[i][1]=position[x][1]-1 stack_y.append(position[i][1]) elif y...
p00746
<h1><font color="#000000">Problem A:</font> Pablo Squarson's Headache</h1> <!-- begin en only --> <p>Pablo Squarson is a well-known cubism artist. This year's theme for Pablo Squarson is "Squares". Today we are visiting his studio to see how his masterpieces are given birth.</p> <!-- end en only --> <!-- begin...
1 5 0 0 0 1 0 2 0 3 12 0 0 1 0 2 0 3 1 4 1 5 1 6 2 7 2 8 2 9 3 10 3 10 0 2 1 2 2 2 3 2 2 1 5 1 6 1 7 1 8 1 0
1 1 3 3 4 4 5 6
24,803
s922043438
p00746
u281836941
1514714064
Python
Python3
py
Accepted
80
5640
463
def add(a,b): return (a[0]+b[0],a[1]+b[1]) dic={0:(-1,0),1:(0,-1),2:(1,0),3:(0,1)} while 1: n=int(input()) if n==0: break elif n==1: print(1,1) continue v=[(0,0)] for i in range(n-1): a,b=map(int,input().split()) v.append(add(v[a],dic[b])) solve=...
p00746
<h1><font color="#000000">Problem A:</font> Pablo Squarson's Headache</h1> <!-- begin en only --> <p>Pablo Squarson is a well-known cubism artist. This year's theme for Pablo Squarson is "Squares". Today we are visiting his studio to see how his masterpieces are given birth.</p> <!-- end en only --> <!-- begin...
1 5 0 0 0 1 0 2 0 3 12 0 0 1 0 2 0 3 1 4 1 5 1 6 2 7 2 8 2 9 3 10 3 10 0 2 1 2 2 2 3 2 2 1 5 1 6 1 7 1 8 1 0
1 1 3 3 4 4 5 6
24,804
s031254554
p00749
u260980560
1497566066
Python
Python
py
Accepted
50
6872
1,742
from collections import deque dd = [(-1, 0), (0, -1), (1, 0), (0, 1)] while 1: w, h = map(int, raw_input().split()) if w == h == 0: break P = [list(raw_input()) for i in xrange(h)] L = [[None]*w for i in xrange(h)] deq = deque() cnt = 0 g = []; XL = []; XR = []; M = []; C = [] f...
p00749
<h1><font color="#000000">Problem D:</font> Off Balance</h1> <!-- end en only --> <!-- begin en only --> <p> You are working for an administration office of the International Center for Picassonian Cubism (ICPC), which plans to build a new art gallery for young artists. The center is organizing an architectural de...
4 5 ..33 ..33 2222 ..1. .111 5 7 ....1 .1..1 .1..1 11..1 .2222 ..111 ...1. 3 6 .3. 233 23. 22. .11 .11 4 3 2222 ..11 ..11 4 5 .3.. 33.. 322. 2211 .11. 3 3 222 2.1 111 3 4 11. 11. .2. 222 3 4 .11 .11 .2. 222 2 7 11 .1 21 22 23 .3 33 2 3 1. 11 .1 0 0
STABLE STABLE STABLE UNSTABLE STABLE STABLE UNSTABLE UNSTABLE UNSTABLE UNSTABLE
24,807
s489115500
p00760
u847467233
1531556371
Python
Python3
py
Accepted
30
5588
242
# AOJ 1179: Millennium # Python3 2018.7.14 bal4u for cno in range(int(input())): y, m, d = map(int, input().split()) ans = 195*y if y > 1: ans += 5*((y-1)//3) if y % 3: ans += 19*(m-1) + m//2 else: ans += (m-1)*20 print(196666-ans-d)
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,827
s065937843
p00760
u467175809
1531736221
Python
Python
py
Accepted
10
5036
461
#!/usr/bin/env python import sys import math import itertools as it from collections import deque sys.setrecursionlimit(10000000) n = input() for loop in range(n): y, m, d = map(int, raw_input().split()) m_lst = [20, 19, 20, 19, 20, 19, 20, 19, 20, 19] cnt = 0 for i in range(m - 1): cnt += m...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,828
s911864857
p00760
u328199937
1555816837
Python
Python3
py
Accepted
20
5608
444
n = int(input()) anslist = [] Y = 1000 M = 1 D = 1 ans = 195 * (Y - 1) ans += (Y - 1) // 3 * 5 ans += 20 * (M - 1) ans += D if Y % 3 != 0: ans -= (M - 1) // 2 milenium = ans for i in range(n): Y, M, D = map(int, input().split()) ans = 195 * (Y - 1) ans += (Y - 1) // 3 * 5 ans += 20 * (M - 1) ...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,829
s444244673
p00760
u242221792
1556263091
Python
Python3
py
Accepted
20
5592
279
c = int(input()) a = [0] for i in range(30): if i%2 == 0 or i >= 20: a.append(a[i]+20) else: a.append(a[i]+19) for i in range(c): y, m, d = map(int,input().split()) b = int((y-1)/3) * 590 + a[m + ((y+2)%3) * 10 - 1] + d print(196470 - b + 1)
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,830
s269823037
p00760
u788553535
1559164941
Python
Python3
py
Accepted
30
5612
399
n = int(input()) for _ in range(n): y,m,d = map(int,input().split()) days = 0 if d!=1: days += (20-d) if y%3!=0 and m%2==0 else (21-d) d = 1 if m==10: y += 1 m = 1 else: m+=1 if y!=1000: days += sum([19 if y%3!=0 and i%2==0 else 20 for i in range(11-m)]) y += 1 days...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,831
s996697758
p00760
u300645821
1413361332
Python
Python
py
Accepted
20
4208
154
n=int(raw_input()) for i in range(0,n): y,m,d=[int(e) for e in raw_input().split()] y-=1;m-=1 print(196471-y*195-y//3*5-m*20+(m//2 if y%3!=2 else 0)-d)
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,832
s849232838
p00760
u300645821
1413361342
Python
Python3
py
Accepted
30
6720
209
import sys if sys.version_info[0]>=3: raw_input=input n=int(raw_input()) for i in range(0,n): y,m,d=[int(e) for e in raw_input().split()] y-=1;m-=1 print(196471-y*195-y//3*5-m*20+(m//2 if y%3!=2 else 0)-d)
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,833
s830146693
p00760
u966364923
1419472495
Python
Python3
py
Accepted
30
6720
392
def day(y, m, d): days = 0 days += (y-1)*195 days += (y-1)//3*5 days += (m-1)*19 if y%3 == 0: days += (m-1) else: days += m//2 days += (d-1) return days def main(): n = int(input()) for _ in range(n): (y, m, d) = [int(x) for x in input().split()] ...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,834
s302810692
p00760
u617183767
1420259247
Python
Python
py
Accepted
10
4660
812
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import sys import itertools import math from collections import Counter, defaultdict class Main(object): def __init__(self): pass def solve(self): ''' insert your code ''' n = input() mil = 196470 ...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,835
s831647247
p00760
u316268279
1420606250
Python
Python3
py
Accepted
40
6724
372
#!/usr/bin/env python # -*- coding: utf-8 -*- def date2num(y,m,d): t = (y-1)//3 days = t*10*20 + (y-1-t)*5*20+(y-1-t)*5*19 if y%3 == 0: days += (m-1)*20+d else: days += (m-1)//2*19+(m-1-(m-1)//2)*20+d return days for i in range(int(input())): y,m,d = map(int,input().split("...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,836
s458008786
p00760
u766477342
1420913395
Python
Python3
py
Accepted
50
6724
340
M = [19, 20] Y = sum(M) * 5 for i in range(int(input())): res = 0 y,m,d = list(map(int,input().split())) for y_2 in range(1000-1, y, -1): res += Y if y_2 % 3 != 0 else 200 for m_2 in range(10, m, -1): res += M[m_2 % 2] if y % 3 != 0 else 20 res += (M[m%2] if y % 3 != 0 else 20) - ...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,837
s397286988
p00760
u731235119
1421841532
Python
Python
py
Accepted
40
4232
368
n = int(raw_input()) for i in range(n): Y, M, d = map(int, raw_input().split(" ")) day_total = 0 if Y % 3 == 0: day_sub = (M-1) * 20 + d - 1 else : small_M = (M - 1) / 2 day_sub = (M - 1 - small_M) * 20 + small_M * 19 + d - 1 for y in range(Y,1000): if y % 3 == 0: day_total += 10 * 20 else : day_t...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,838
s259403606
p00760
u124909914
1425614216
Python
Python3
py
Accepted
30
6728
315
n = int(input()) for i in range(n): y,m,d = map(int, input().split()) dif = 999 - y leap = int(dif / 3) + 1 common = dif - leap + 1 days = leap * 200 + common * 195 # days from y 1 1 days -= (m - 1) * 20 if y % 3 != 0: days += int((m - 1) / 2) days -= (d - 1) print(days)
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,839
s565885901
p00760
u260980560
1441025938
Python
Python
py
Accepted
30
6372
293
n = input() for _ in xrange(n): y, m, d = map(int, raw_input().split()) m -= 1 ans = 1 for t in xrange(y+1, 1000): ans += 195 if t%3 else 200 for t in xrange(m+1, 10): ans += 19 if y%3 and t%2 else 20 ans += 19-d if y%3 and m%2 else 20-d print ans
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,840
s000110784
p00760
u685815919
1474597695
Python
Python
py
Accepted
20
6280
318
n = int(raw_input()) base = 196471 year = 195 month = [20,19,20,19,20,19,20,19,20,19] for _ in xrange(n): Y,M,D = map(int, raw_input().split()) days = 0 days += (Y-1) * year + (Y-1) / 3 * 5 for i in xrange(M-1): if Y%3 == 0: days += 20 else: days += month[i] days += D print base - days
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,841
s675991660
p00760
u166860661
1480839312
Python
Python
py
Accepted
10
6432
471
def da(Y,M,D): day = (Y / 3) * 590 if Y % 3 == 0: day = day - 200 + (M - 1)*20 + D else: day = day + (Y%3 - 1) * 195 if M%2 == 1: day = day + (M/2 * 39) + D else: day = day + (M/2 - 1) * 39 + 20 + D return day n = int(raw_input()...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,842
s557994886
p00760
u660912567
1481398548
Python
Python3
py
Accepted
20
7604
219
for _ in range(int(input())): y,m,d = map(int,input().split()) vy,vm,vd = y-1,m-1,d-1 r = vy//3*590 + vy%3*195 r += vd if (vy+1)%3==0: r += vm*20 else: r += vm//2*39 + vm%2*20 print(196470-r)
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,843
s382643882
p00760
u922871577
1482211273
Python
Python
py
Accepted
40
6372
692
N = int(raw_input()) D1 = 20*5 + 19*5 D2 = 20*10 for i in xrange(N): y, m, d = map(int, raw_input().split()) ans = 0 if d != 1: if y % 3 == 0 or m % 2 == 1: last = 20 else: last = 19 ans += last - d + 1 d = 1 if m < 10: m += 1 ...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,844
s304923158
p00760
u128892650
1482848168
Python
Python3
py
Accepted
30
7656
325
# coding: utf-8 def day(y,m,d): my,mm,md = y-1,m-1,d-1 day = my // 3 * 590 + my % 3 * 195 + md if y % 3 == 0: day += mm * 20 else: day += mm // 2 * 39 + mm % 2 * 20 return day n = int(input()) for i in range(n): Y,M,D = [int(x) for x in input().split()] print(196470 - day(Y,...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,845
s960888188
p00760
u078042885
1485537352
Python
Python3
py
Accepted
30
7676
154
for _ in range(int(input())): y,m,d=map(int,input().split()) y-=1;m-=1 print(196471-(y//3*590+y%3*195+(m*20 if y%3==2 else m//2*39+m%2*20)+d))
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,846
s222254684
p00760
u633333374
1485919533
Python
Python
py
Accepted
10
6316
399
def Year(): Ya = 0 for j in range(Y-1): Ya += 19*5+20*5 for j in range((Y-1)/3): Ya += 5 return Ya def Mouth(): Ma = 0 for i in range(1, M): if Y%3 == 0: Ma += 20 else: Ma += 19 + (i%2) return Ma x = int(raw_input()) for i in range(x):...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,847
s677911477
p00760
u661290476
1487398319
Python
Python3
py
Accepted
20
7576
268
n = int(input()) for _ in range(n): y, m, d = map(int, input().split()) ans = (1000 - y) * 195 + (1002 - y) // 3 * 5 if y % 3 == 0: tyear = (m - 1) * 20 + d - 1 else: tyear = (m - 1) * 20 + d - 1 - ((m - 1) // 2) print(ans - tyear)
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,848
s442340249
p00760
u741801763
1506164946
Python
Python3
py
Accepted
60
7592
524
if __name__ == "__main__": n = int(input()) for _ in range(n): count = 0 y,m,d = list(map(int,input().strip().split())) if y %3 == 0:count += 20 - d +1 elif m &1: count +=20 -d + 1 else :count += 19-d+1 for i in range(m + 1,11): if y % 3 ==0: count +=2...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,849
s766242580
p00760
u506554532
1512924343
Python
Python3
py
Accepted
20
5640
434
N = int(input()) src = [map(int,input().split()) for i in range(N)] days_normal = (20+19)*5 days_special = 20*10 days_3years = 2*days_normal + days_special def passed(y,m,d): ret = ((y-1)//3) * days_3years ret += ((y-1)%3) * days_normal for i in range(m-1): ret += (20 if y%3 == 0 or i%2 == 0 else ...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,850
s640445280
p00760
u146816547
1524313724
Python
Python
py
Accepted
10
4668
380
n = int(raw_input()) for i in range(n): Y, M, D = map(int, raw_input().split()) days = 0 for i in range(1, Y): if i % 3 == 0: days += 200 else: days += 39*5 for i in range(1, M): if Y % 3 != 0 and i % 2 == 0: days += 19 else: ...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,851
s110684165
p00760
u146816547
1524313819
Python
Python
py
Accepted
20
4668
380
n = int(raw_input()) for _ in range(n): Y, M, D = map(int, raw_input().split()) days = 0 for i in range(1, Y): if i % 3 == 0: days += 200 else: days += 39*5 for i in range(1, M): if Y % 3 != 0 and i % 2 == 0: days += 19 else: ...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,852
s703249860
p00760
u509278866
1527824024
Python
Python3
py
Accepted
60
9040
965
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**3 eps = 1.0 / 10**10 mod = 10**9+7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF():...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,853
s417548774
p00760
u591052358
1528262235
Python
Python3
py
Accepted
20
5600
348
n = int(input()) def solve(Y,M,D): ans = 0 ans += (Y - 1) * (19 + 20) * 5 ans += ((Y -1)// 3) * 5 ans += 19 * (M-1) if Y % 3 ==0: ans += (M-1) else: ans += (M // 2) ans += (D-1) print(196470 - ans) for i in range(n): l = input().split(' ') solve(int(l[0]...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,854
s949262313
p00760
u136916346
1529983888
Python
Python3
py
Accepted
30
5592
304
n=int(input()) for _ in range(n): y,m,d=list(map(int,input().split())) c=0 for i in range(1,y): if i%3:c+=195 else:c+=200 for i in range(1,m): if y%3: if i%2:c+=20 else:c+=19 else: c+=20 c+=(d-1) print(196470-c)
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,855
s005516780
p00760
u300645821
1344327609
Python
Python
py
Accepted
10
4220
211
#!/usr/bin/python import sys n=int(sys.stdin.readline()) for i in range(0,n): a=map(int,sys.stdin.readline().split()) a[0]-=1;a[1]-=1; print 196471-a[0]*195-a[0]/3*5-a[1]*20+(a[1]/2 if a[0]%3!=2 else 0)-a[2]
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,856
s931916968
p00760
u609255173
1344855865
Python
Python
py
Accepted
10
4224
274
def calc(y, m, d): ret = d ret += (y - 1) * 39 * 5 ret += 5 * ((y - 1) / 3) for j in range(1, m): if y % 3 == 0: ret += 20 else: ret += 19 + (j % 2) return ret for i in range(int(raw_input())): print calc(1000, 1, 1) - calc(*map(int, raw_input().split()))
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,857
s064294176
p00760
u109084363
1359273704
Python
Python
py
Accepted
20
4240
512
import sys def daysOfYear(y): if y <= 0: return 0 elif y % 3 == 0: return 200 else: return 195 def daysOfMonth(y, m): if y % 3 == 0 or m % 2 == 1: return 20 else: return 19 mil = 1 for i in xrange(1, 1000): mil += daysOfYear(i) raw_input() for line in...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,858
s552000083
p00760
u814249052
1370880263
Python
Python
py
Accepted
30
4288
867
def datesOfTheYear(year): if year % 3 == 0: return 200 return 195 def datesOfTheMonth(year, month): if year % 3 == 0: return 20 if month % 2 == 0: return 19 else: return 20 def datesFromBorn(birthyear, birthmonth, birthdate): result = 0 for y in range(bir...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,859
s496984622
p00760
u104911888
1372558661
Python
Python
py
Accepted
20
4240
261
for i in range(input()): y,m,d=map(int,raw_input().split()) s=sum(200 if i%3==0 else 195 for i in range(y+1,1000)) t=0 for i in range(m,11): if y%3!=0: t+=20 if i%2==1 else 19 else: t+=20 print s+t-d+1
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,860
s259596636
p00760
u621997536
1387241593
Python
Python
py
Accepted
20
4212
308
n = input() for i in range(n): a = 0 y, m, d = map(int, raw_input().split()) a += 195 * (999 - y) a += (999 / 3 - y / 3) * 5 if y % 3 : a += (10 - m) * 19 + (10 - m) / 2 a += 20 - d - (m + 1) % 2 + 1 else: a += (10 - m) * 20 a += 20 - d + 1 print a
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,861
s945686175
p00760
u633068244
1399453812
Python
Python
py
Accepted
20
4200
142
for _ in range(input()): y,m,d = map(int,raw_input().split()) print 196470 - ((y-1)*195 + (y-1)/3*5 + 20*(m-1) - min(1,y%3)*((m-1)/2) + d-1)
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,862
s180701142
p00760
u633068244
1399453848
Python
Python
py
Accepted
20
4204
142
for _ in range(input()): y,m,d = map(int,raw_input().split()) print 196470 - ((y-1)*195 + (y-1)/3*5 + 20*(m-1) - min(1,y%3)*((m-1)/2) + d-1)
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,863
s020851122
p00760
u633068244
1399453852
Python
Python
py
Accepted
10
4200
142
for _ in range(input()): y,m,d = map(int,raw_input().split()) print 196470 - ((y-1)*195 + (y-1)/3*5 + 20*(m-1) - min(1,y%3)*((m-1)/2) + d-1)
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,864
s445952344
p00760
u300645821
1400581167
Python
Python
py
Accepted
20
4212
193
import sys n=int(sys.stdin.readline()) for i in range(0,n): a=map(int,sys.stdin.readline().split()) a[0]-=1;a[1]-=1 print(196471-a[0]*195-a[0]/3*5-a[1]*20+(a[1]/2 if a[0]%3!=2 else 0)-a[2])
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,865
s144204612
p00760
u300645821
1400581344
Python
Python
py
Accepted
20
4216
218
import sys if sys.version_info[0]>=3: raw_input=input n=int(raw_input()) for i in range(0,n): a=map(int,raw_input().split()) a[0]-=1;a[1]-=1 print(196471-a[0]*195-a[0]/3*5-a[1]*20+(a[1]/2 if a[0]%3!=2 else 0)-a[2])
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,866
s799459029
p00760
u300645821
1400581460
Python
Python
py
Accepted
10
4220
227
import sys if sys.version_info[0]>=3: raw_input=input n=int(raw_input()) for i in range(0,n): a=[int(e) for e in raw_input().split()] a[0]-=1;a[1]-=1 print(196471-a[0]*195-a[0]/3*5-a[1]*20+(a[1]/2 if a[0]%3!=2 else 0)-a[2])
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,867
s802308022
p00760
u300645821
1400581493
Python
Python3
py
Accepted
30
6724
229
import sys if sys.version_info[0]>=3: raw_input=input n=int(raw_input()) for i in range(0,n): a=[int(e) for e in raw_input().split()] a[0]-=1;a[1]-=1 print(196471-a[0]*195-a[0]//3*5-a[1]*20+(a[1]//2 if a[0]%3!=2 else 0)-a[2])
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,868
s538529403
p00760
u240091169
1595389956
Python
Python3
py
Accepted
50
5600
483
def days(y, m, d) : cnt = 0 for i in range(1, y) : if i % 3 == 0 : cnt += 200 else : cnt += 195 for i in range(1, m) : if y % 3 == 0 : cnt += 20 else : if i % 2 == 0 : cnt += 19 else : ...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,869
s211735732
p00760
u614847701
1593057265
Python
Python3
py
Accepted
30
5596
601
def get_no_days(day_str): day_split = day_str.split(' ') year = int(day_split[0]) month = int(day_split[1]) day = int(day_split[2]) result = 0 for y in range(1, year, 1): if y % 3 != 0: result += 195 else: result += 200 year_not_mod_3 = (year % 3 != 0...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,870
s676511941
p00760
u489396453
1592626812
Python
Python3
py
Accepted
30
5660
694
import math oneYear = 20*5 + 19*5 threeYears = oneYear*2 + 20*10 millennium = 196471 N = int(input()) for i in range(N): data = input().split() birthYear = int(data[0]) birthMonth = int(data[1]) birthDay = int(int(data[2])) day = 0 #Calc passed years passedYears = birthYear - 1 day +=...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,871
s324793721
p00760
u353888999
1585120578
Python
Python3
py
Accepted
20
5616
398
n = int(input()) cnt = 0 ans = [] for i in range(n): cnt = 0 y,m,d = map(int,input().split()) if y % 3 == 0: cnt += (10-m)*20 + (20-d+1) y += 1 else: cnt += ((10-m)- ((10-m)//2)) * 20 + ((10-m)//2) * 19 + (19-d+1) + 5 y += 1 cnt += ((1000-y)//3) * 200 + ((1000-y)-((10...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,872
s860402668
p00760
u829695570
1578649660
Python
Python3
py
Accepted
30
5592
473
n = int(input()) n1 = 19*5 + 20*5 n2 = 20*10 for _ in range(n): y,m,d = map(int,input().split()) ans = (999-y)//3*(n1*2+n2) if (999-y)%3 == 1: ans += n2 elif (999-y)%3 == 2: ans += n1+n2 if y%3 == 0: ans += (10-m)*20 else: if m%2 == 0: ans += (10-m)//2...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,873
s105577507
p00760
u123563150
1576749320
Python
Python3
py
Accepted
20
5668
337
import sys input=sys.stdin.readline n=int(input()) year=195 from math import ceil for i in range(n): y,m,d=map(int,input().split()) ans=0 ans+=(999-y)*year ans+=(333-y//3)*5 if y%3==0: ans+=(10-m)*20 ans+=(20-d)+1 else: ans+=(10-m)*20 ans-=ceil((10-m)/2) if m%2==0: ans+=(19-d)+1 else: ans+=(20-d...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,874
s701972922
p00760
u479403716
1576748243
Python
Python3
py
Accepted
20
5600
485
n = int(input()) def f(y, m, d): ret = 0 for i in range(1, y): if i % 3 == 0: ret += 20 * 10 else: ret += 20 * 5 + 19 * 5 for j in range(m - 1): if j % 2 == 0: ret += 20 else: if y % 3 == 0: ret += 20 ...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,875
s347633825
p00760
u673194880
1567081815
Python
Python3
py
Accepted
20
5616
1,919
""" 1年1月1日が1日目 3で割り切れる年は 1年が200日 割り切れない日は 1年が195日 3年単位で, 200+195+195 = 590日 +あまりの年×195 月から日への変換方法は もし3で割り切れないあり and (i)月が奇数の時  20 (ii)月が偶数の時 19 日はそのまま足す 1000年1月1日 を基準にする 計算時間短縮のために先に日に直しておこう 1年1月1日を1日目としているから 1年引く (1000-1) // 3 = 333*3 割り切れない 年から日は590*333 + 1*195 月から日は 割り切れない 1は奇数だから +20 と思いきや 1年1月1日を1日...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,876
s427828114
p00760
u811733736
1566995946
Python
Python3
py
Accepted
20
5692
670
# -*- coding: utf-8 -*- """ Millennium http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1179&lang=jp """ import sys from itertools import accumulate memo = [-1] * 1001 memo[1000] = 0 for y in range(999, 0, -1): memo[y] = (20 * 10 if y % 3 == 0 else 20 * 5 + 19 * 5) + memo[y+1] def solve(y, m, d): mo...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,877
s115806817
p00760
u777299405
1563019239
Python
Python3
py
Accepted
20
5592
178
for i in range(int(input())): y, m, d = map(int, input().split()) print(196471 - ((y - 1) * 195 + (y - 1) // 3 * 5 + 20 * (m - 1) - min(1, y % 3) * ((m - 1) // 2) + d))
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,878
s737315076
p00760
u998734722
1562165378
Python
Python3
py
Accepted
30
5592
468
n = int(input()) for i in range(n): y,m,d = map(int,input().split()) only_dai = (1000 - y + 1) // 3 * 10 * 20 dai_shou = ((1000 - y - 1) - (1000 - y + 1) // 3) * (20 * 5 + 19 * 5) if y % 3 == 0: hanpa_m = (10 - m) * 20 else: hanpa_m = (10 - m) * 20 - (10 - m + 1) // 2 if m % 2 ==...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,879
s488811348
p00760
u464321546
1561554010
Python
Python3
py
Accepted
20
5600
330
def main(): y, m, d = map(int, input().split()) a = (y - 1) // 3 b = (y - 1) % 3 c = a * 590 + 195 * b if y % 3: a = (m - 1) // 2 b = (m - 1) % 2 c += a * 39 + b * 20 else: c += (m - 1) * 20 c += d - 1 print(196470-c) n = int(input()) for i in range(n): ...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,880
s308297715
p00760
u853158149
1561551366
Python
Python3
py
Accepted
20
5620
330
import sys def f(y,m,d): res = (y-1)//3*200+(y-1-(y-1)//3)*195 if y%3 == 0: res += (m-1)*20+d else: res += (m-1)//2*19+(m-1-(m-1)//2)*20+d return res M = 196471 n = int(sys.stdin.readline()) for i in range(n): y,m,d = [int(x) for x in sys.stdin.readline().split()] print(M-f...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,881
s036932156
p00760
u989573662
1561551314
Python
Python3
py
Accepted
40
5592
463
#!/usr/bin/env python3 #AOJ A n = int(input()) for _ in range(n): y,m,d = list(map(int,input().split())) sub = 1 for i in range(y+1,1000): if i % 3 == 0: sub += 200 else: sub += 19*5 + 100 if y % 3 == 0: sub += (10 - m)*20 + (20 - d) else: if ...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,882
s221172768
p00760
u200148444
1561370223
Python
Python3
py
Accepted
20
5616
371
n=int(input()) l=[list(map(int,input().split())) for z in range(n)] ans1=196471 for i in range(n): ans2=0 y=l[i][0] m=l[i][1] d=l[i][2] ans2+=(y-1)*195+int((y-1)/3)*5 if y%3==0: ans2+=(m-1)*20 else: if (m-1)%2==0: ans2+=39*(m-1)/2 else: ans2+=3...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,883
s638351734
p00760
u215870135
1561213723
Python
Python3
py
Accepted
30
5592
244
n = int(input()) for i in range(n): y, m, d = map(int, input().split()) tmp = 0 tmp += (y-1) * 195 tmp += ((y-1) // 3) * 5 tmp += (m-1) * 20 if y % 3 != 0: tmp -= (m-1) // 2 tmp += d print(196471 - tmp)
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,884
s514391900
p00760
u037441960
1560767137
Python
Python3
py
Accepted
20
5596
335
def count(Y, M, D) : thr = (Y - 1) // 3 cnt = (Y - thr - 1) * 195 + thr * 200 if(Y % 3 == 0) : cnt += (M - 1) * 20 + D else : m = (M - 1) // 2 cnt += (M - m - 1) * 20 + m * 19 + D print(Mil - cnt + 1) n = int(input()) Mil = 666 * 195 + 333 * 200 for i in range(n) : Y, M, D = map(int, input().split()) co...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,885
s144072832
p00760
u135085051
1560010703
Python
Python3
py
Accepted
40
5608
481
# Millennium ans = [] n = int(input()) for j in range(n): y, m, d = map(int, input().split()) day = 0 for i in range(m, 11): if y % 3 == 0: day += 20 else: if i % 2 == 0: day += 19 else: day += 20 day -= d for i ...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,886
s230942277
p00760
u701749469
1555851468
Python
Python3
py
Accepted
30
5612
2,404
LGE = 20 SML = 19 FUTU = 195 URUU = 200 YEAR3 = 590 def main(): howmany = int(input()) for i in range(howmany): daycount = 0 dataset = input() dataset = dataset.split(" ") for j in range(len(dataset)): dataset[j] = int(dataset[j]) #print("-...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,887
s432959012
p00760
u281836941
1513077292
Python
Python3
py
Accepted
60
5600
495
n=int(input()) table=[0,20, 39, 59, 78, 98, 117, 137, 156, 176, 195] u_table=[0,20, 40, 60, 80, 100, 120, 140, 160, 180, 200] for i in range(n): y,m,d=map(int,input().split()) ans=0 for j in range(y+1,1000): if j%3==0: ans+=u_table[-1] else: ans+=table[-1] if y%3=...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,888
s655163344
p00760
u717727327
1420990551
Python
Python
py
Accepted
20
4240
383
def solve(y, m, d): Y = [195, 195, 200] M = [20, 19] ret = 196471 for i in range(y-1): ret -= Y[i % 3] if y % 3 == 0: ret -= (m-1) * 20 else: for i in range(m-1): ret -= M[i % 2] ret -= d return ret N = int(raw_input()) for _ in range(N): y, m,...
p00760
<h1>Millennium</h1> <p> A wise king declared a new calendar. "Tomorrow shall be the first day of the calendar, that is, the day 1 of the month 1 of the year 1. Each year consists of 10 months, from month 1 through month 10, and starts from a <i>big month</i>. A common year shall start with a big month, followed by...
8 1 1 1 344 3 1 696 5 1 182 9 5 998 8 7 344 2 19 696 4 19 999 10 20
196470 128976 59710 160715 252 128977 59712 1
24,889
s716905260
p00761
u667806071
1530885742
Python
Python3
py
Accepted
30
5596
394
def solve(n, l): results = [n] for i in range(20): s = list(("%0" + str(l) + "d") % n) s.sort() n = int("".join(s[::-1])) - int("".join(s)) if n in results: break results.append(n) j = results.index(n) print(j, n, i - j + 1) while True: n, l = map...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,890
s104018993
p00761
u946263060
1532013286
Python
Python3
py
Accepted
50
5628
1,166
def is_unique2(seq): seen = [] unique_list = [x for x in seq if x not in seen and not seen.append(x)] return len(seq) == len(unique_list) while True: iCount = 0 n = input().split() if int(n[1]) == 0: break num = n.pop(0) m = int(n[0]) numStr = list(num) while len(numStr) ...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,891
s747616673
p00761
u946263060
1532017825
Python
Python3
py
Accepted
40
5624
3,316
def is_unique2(seq):#後のwhile文でのループ脱出のため seen = [] unique_list = [x for x in seq if x not in seen and not seen.append(x)] return len(seq) == len(unique_list) while True: iCount = 0#問のiの部分の値です n = input().split() if int(n[1]) == 0:#入力の終わりを受けとった時breakする break a0 = n.pop(0)#a0は問のa0の値を受け取...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,892
s697458841
p00761
u328199937
1556032777
Python
Python3
py
Accepted
40
5616
772
def pluss_zero(a, L): a = str(a) while len(a) < L: a = "0" + a return a def make_maxminnum(a): a = list(a) a.sort() maxa = int("".join(a[::-1])) mina = int("".join(a)) return maxa - mina ans_list = [] while True: a, L = map(int, input().split()) if a == 0 and L == 0: ...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,893
s989442798
p00761
u242221792
1556263396
Python
Python3
py
Accepted
40
5604
690
def sort_MxMn(SeriesA): global max_a, min_a listA = list(str(SeriesA)) while len(listA) < b: listA.append("0") listA = [int(x) for x in listA] max_a = sorted(listA, reverse=True) min_a = sorted(listA) def translate(listEx): num = 0 for i in range(b): num += listEx[i]*(10...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,894
s805159513
p00761
u408260374
1419169634
Python
Python3
py
Accepted
30
6720
501
while True: a0, l = map(int, input().split()) if a0 == 0 and l == 0: break seq = [a0] a = str(a0) for i in range(20): if len(a) < l: a = '0' * (l - len(a)) + a a_min = int(''.join(sorted(list(a)))) a_max = int(''.join(sorted(list(a), reverse=True))) ai = a...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,895
s833055962
p00761
u617183767
1420631156
Python
Python
py
Accepted
30
4660
1,099
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import sys import itertools import math from collections import Counter, defaultdict class Main(object): def __init__(self): pass def solve(self): ''' insert your code ''' while True: a0, l = map...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,896
s981695741
p00761
u766477342
1421505023
Python
Python3
py
Accepted
40
6724
406
while 1: a, l = input().split() if a=='0' and l == '0':break l = int(l) a = ''.join(a.zfill(l)) a_lst = [a] while 1: a = ''.join(sorted(a)) a_r = ''.join(reversed(a)) a = str(int(a_r) - int(a)).zfill(l) if a in a_lst: j = a_lst.index(a) pri...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,897
s732933874
p00761
u316268279
1421854447
Python
Python3
py
Accepted
40
6724
497
#!/usr/bin/env python # -*- coding: utf-8 -*- while True: a,L = map(int,input().split(" ")) if a == 0 and L == 0: break a_set = dict() a_set[a] = 0 a = str(a) a = a + '0' * ( L - len(a)) i = 1 while True: a = int(''.join(reversed(sorted(a)))) - int(''.join(sorted(a))) ...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,898
s056677971
p00761
u731235119
1421986622
Python
Python
py
Accepted
20
4244
553
def ai2aip1 (ai, L): ai_sort = sorted(ai) max_num = "" min_num = "" for s in ai_sort[::-1]: max_num += s for s in ai_sort: min_num += s max_num += "0" * (L - len(max_num)) tmpaip1 = int(max_num) - int(min_num) tmpaip1 = str(tmpaip1) aip1 = "0" * (L - len(tmpaip1)) + tmpaip1 return aip1 while 1: a, L = r...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,899
s140373804
p00761
u124909914
1432694682
Python
Python3
py
Accepted
40
6724
458
while True: a, L = map(int, input().split()) if a == 0 and L == 0: break nums = [a] for i in range(20): ds = list(str(a)) while len(ds) != L: ds.append('0') ln = int("".join(sorted(ds))) gn = int("".join(sorted(ds, reverse=True))) n = gn - ln if n in...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,900
s611173003
p00761
u998188826
1444472764
Python
Python3
py
Accepted
100
7608
347
while True: a, l = map(int, input().split()) if (a, l) == (0, 0): break arr = [a] for i in range(20): p = list(map(int, '{0:0>{1}}'.format(a, l))) a = int(''.join(map(str,sorted(p, reverse=True)))) - int(''.join(map(str,sorted(p)))) if a in arr: break arr.append(a) j = arr.index(a) print('{} {} {}...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,901
s946316567
p00761
u481456091
1457626873
Python
Python3
py
Accepted
60
7608
458
while True: list_a = [] a, L = input().split(" ") if a=='0' and L=='0': break L = int(L) list_a.append(int(a)) while True: if len(a) < L: a += '0'*(L-len(a)) an = int(''.join(sorted(a, reverse=True))) - int(''.join(sorted(a))) if an in list_a: idx = list_a.in...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,902
s466950460
p00761
u685815919
1474608482
Python
Python
py
Accepted
20
6464
429
while True: a0,L = map(int, raw_input().split()) if a0==L==0: break dic = {} dic[a0] = 0 a = a0 i = 1 while True: if len(str(a)) < L: a *= 10 ** (L-len(str(a))) amax = int("".join(sorted(str(a), reverse=True))) amin = int("".join(sorted(str(a), reverse=False))) a = amax - amin if...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,903
s449170431
p00761
u660912567
1484302675
Python
Python3
py
Accepted
50
7668
350
while True: a,l = input().split() if a==l=='0': break nl,i = [a],0 while True: mx = int(''.join(sorted(list(a.zfill(int(l))),reverse=True))) mn = int(''.join(sorted(list(a)))) a = str(mx-mn) if a in nl: print(nl.index(a),a,i-nl.index(a)+1) break ...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,904
s749590165
p00761
u078042885
1484306839
Python
Python3
py
Accepted
40
7620
258
while 1: n,d=input().split() if n==d=='0':break a=[int(n)] while 1: n=''.join(sorted(n.zfill(int(d)))) b = int(n[::-1]) - int(n) if b in a:break a+=[b] n=str(b) print(a.index(b),b,len(a)-a.index(b))
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,905
s311359976
p00761
u667806071
1494771163
Python
Python3
py
Accepted
30
7580
576
while True: a, l = map(int, input().split()) if a == l == 0: break calced = {} zfill = ("{0:0%dd}" % l).format cnt = 0 while True: if calced.get(a) == None: calced[a] = cnt else: # print(calced, a, cnt) print(calced[a], a, cnt - calced[...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,906
s984611497
p00761
u923668099
1495670321
Python
Python3
py
Accepted
30
7640
636
import sys inf = 1<<30 def solve(): while 1: a, L = map(int, sys.stdin.readline().split()) if a == L == 0: return made = {a:0} i = 0 while True: i += 1 amax, amin = make_maxmin(a, L) a = amax - amin if a in mad...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,907
s026955395
p00761
u339921062
1498628519
Python
Python
py
Accepted
20
6348
412
while 1: a0, L = map(int, raw_input().split()) if a0 == L == 0: break d = {a0: 0} cur = 0 while 1: cur += 1 num = str(a0) num += "0"*(L - len(num)) s = sorted(num) p = int("".join(s[::-1])); q = int("".join(s)) a1 = p - q if a1 in d: ...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,908
s779126969
p00761
u260980560
1498659970
Python
Python
py
Accepted
30
6472
536
while 1: a, L = map(int, raw_input().split()) if a == L == 0: break def f(a): num = str(a) num += "0"*(L - len(num)) num = sorted(num) return int("".join(num[::-1])) - int("".join(num)) # Floyd's cycle-finding algorithm b = c = a while 1: b = f(b)...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,909
s723292190
p00761
u667806071
1499682763
Python
Python3
py
Accepted
50
7680
396
while True: n, d = map(int, input().split()) if n == 0 and d == 0: break a = [n] cnt = 0 while True: t = list(map(int, list(("{:0%d}"%d).format(n)))) n = int("".join(map(str, sorted(t, reverse=True)))) - int("".join(map(str, sorted(t)))) if n in a: break ...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,910
s718142699
p00761
u506554532
1513133687
Python
Python3
py
Accepted
40
5596
427
def next(n,l): li = list(str(n).zfill(l)) mn = int(''.join(sorted(li))) mx = int(''.join(sorted(li,reverse=True))) return mx - mn while True: N,L = map(int,input().split()) if L == 0: break arr = [N] for i in range(1,25): ai = next(arr[-1], L) if ai in arr: j...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,911
s471291099
p00761
u023471147
1527061169
Python
Python3
py
Accepted
40
5604
616
while True: a, l = map(int, input().split()) if a == l == 0: break nums = [a] cnt = 0 while True: cnt += 1 li = list() for i in reversed(range(l)): li.append(a // (10 ** i)) a %= 10 ** i amin = int(''.join(map(str, sorted(li)))) ...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,912
s230400494
p00761
u509278866
1527916011
Python
Python3
py
Accepted
70
9032
1,184
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 eps = 1.0 / 10**10 mod = 10**9+7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF()...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,913
s515799836
p00761
u591052358
1528461480
Python
Python3
py
Accepted
40
5604
658
def solve(a , L , ans,a_n): lis = str(a) lis = list(lis) for i in range(L - len(lis)): lis.append('0') lis.sort() a_ = 0 dig = 1 for i in lis: a_ += int(i) * dig #print(type(i)) dig *= 10 dig = 1 for i in reversed(lis): a_ -= int(i) * dig ...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,914
s424652206
p00761
u136916346
1530196090
Python
Python3
py
Accepted
30
5640
360
from itertools import count while 1: a,p=map(int,input().split()) if not a and not p:break a=str(a).zfill(p) b=[a] f=lambda l:int("".join(l)) i=0 for j in count(1): m=sorted(a) a=str(f(m[::-1])-f(m)).zfill(p) if a in b: i=b.index(a) break ...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,915
s568475815
p00761
u109084363
1360308356
Python
Python
py
Accepted
20
4236
324
while True: a, l = map(int, raw_input().split()) if a == l == 0: break check = {} i = 0 while a not in check: temp = list(str(a).zfill(l)) temp.sort() check[a] = i a = int(''.join(temp[::-1])) - int(''.join(temp)) i += 1 print check[a], a, i - chec...
p00761
<h1>Recurring Decimals</h1> <!-- end en only --> <!-- begin en only --> <p> A decimal representation of an integer can be transformed to another integer by rearranging the order of digits. Let us make a sequence using this fact. </p> <p> A non-negative integer <i>a</i><sub>0</sub> and the number of digits <i>L</i> ...
2012 4 83268 6 1112 4 0 1 99 2 0 0
3 6174 1 1 862632 7 5 6174 1 0 0 1 1 0 1
24,916