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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s768966456 | p00586 | u314166831 | 1562221836 | Python | Python3 | py | Accepted | 30 | 5692 | 1,961 | # coding=utf-8
###
### for atcorder program
###
import sys
import math
# math class
class mymath:
### pi
pi = 3.14159265358979323846264338
### Prime Number
def pnum_eratosthenes(self, n):
ptable = [0 for i in range(n+1)]
plist = []
for i in range(2, n+1):
if... | p00586 |
<H1>A + B Problem</H1>
<p>
Compute A + B.
</p>
<H2>Input</H2>
<p>
The input will consist of a series of pairs of integers A and B separated by a space, one pair of integers per line. The input will be terminated by EOF.
</p>
<H2>Output</H2>
<p>
For each pair of input integers A and B, you must output the sum... | 1 2
10 5
100 20
| 3
15
120
| 23,275 |
s404551741 | p00586 | u136695294 | 1553173295 | Python | Python3 | py | Accepted | 20 | 5580 | 100 | while True:
try:
a,b=map(int,input().split(" "))
print(a+b)
except Exception:
break
| p00586 |
<H1>A + B Problem</H1>
<p>
Compute A + B.
</p>
<H2>Input</H2>
<p>
The input will consist of a series of pairs of integers A and B separated by a space, one pair of integers per line. The input will be terminated by EOF.
</p>
<H2>Output</H2>
<p>
For each pair of input integers A and B, you must output the sum... | 1 2
10 5
100 20
| 3
15
120
| 23,276 |
s741799501 | p00586 | u316584871 | 1538295522 | Python | Python3 | py | Accepted | 20 | 5588 | 115 | while True:
try:
a,b = map(int, input().split())
print(a+b)
except EOFError:
break
| p00586 |
<H1>A + B Problem</H1>
<p>
Compute A + B.
</p>
<H2>Input</H2>
<p>
The input will consist of a series of pairs of integers A and B separated by a space, one pair of integers per line. The input will be terminated by EOF.
</p>
<H2>Output</H2>
<p>
For each pair of input integers A and B, you must output the sum... | 1 2
10 5
100 20
| 3
15
120
| 23,277 |
s488228094 | p00586 | u467175809 | 1533208043 | Python | Python3 | py | Accepted | 30 | 5576 | 60 | try:
while 1:print(sum(map(int,input().split())))
except:1
| p00586 |
<H1>A + B Problem</H1>
<p>
Compute A + B.
</p>
<H2>Input</H2>
<p>
The input will consist of a series of pairs of integers A and B separated by a space, one pair of integers per line. The input will be terminated by EOF.
</p>
<H2>Output</H2>
<p>
For each pair of input integers A and B, you must output the sum... | 1 2
10 5
100 20
| 3
15
120
| 23,278 |
s447827390 | p00586 | u467175809 | 1533207411 | Python | Python | py | Accepted | 10 | 4620 | 60 | import sys
for l in sys.stdin:print sum(map(int,l.split()))
| p00586 |
<H1>A + B Problem</H1>
<p>
Compute A + B.
</p>
<H2>Input</H2>
<p>
The input will consist of a series of pairs of integers A and B separated by a space, one pair of integers per line. The input will be terminated by EOF.
</p>
<H2>Output</H2>
<p>
For each pair of input integers A and B, you must output the sum... | 1 2
10 5
100 20
| 3
15
120
| 23,279 |
s235249978 | p00586 | u539753516 | 1532474990 | Python | Python3 | py | Accepted | 30 | 5576 | 77 | while True:
try:print(sum(map(int,input().split(" "))))
except:break
| p00586 |
<H1>A + B Problem</H1>
<p>
Compute A + B.
</p>
<H2>Input</H2>
<p>
The input will consist of a series of pairs of integers A and B separated by a space, one pair of integers per line. The input will be terminated by EOF.
</p>
<H2>Output</H2>
<p>
For each pair of input integers A and B, you must output the sum... | 1 2
10 5
100 20
| 3
15
120
| 23,280 |
s812103569 | p00586 | u822200871 | 1448118631 | Python | Python3 | py | Accepted | 20 | 7508 | 174 | output = []
while True:
try:
a, b = map(int, input().split())
except :
break
output.append(a+b)
for x in range(len(output)):
print(output[x])
| p00586 |
<H1>A + B Problem</H1>
<p>
Compute A + B.
</p>
<H2>Input</H2>
<p>
The input will consist of a series of pairs of integers A and B separated by a space, one pair of integers per line. The input will be terminated by EOF.
</p>
<H2>Output</H2>
<p>
For each pair of input integers A and B, you must output the sum... | 1 2
10 5
100 20
| 3
15
120
| 23,281 |
s910990930 | p00587 | u473221511 | 1466521284 | Python | Python | py | Accepted | 20 | 6516 | 5,589 | import sys
def searchcenter (str):
temp_layer = 0
for x in range(len(str)):
c = str[x]
if c == '(':
temp_layer += 1
elif c == ')':
temp_layer -= 1
elif temp_layer == 1:
return x
#whether either tree have common factor
def either_tree_have (t... | p00587 |
<H1>Binary Tree Intersection And Union</H1>
<p>
Given two binary trees, we consider the “intersection” and “union” of them.
Here, we distinguish the left and right child of a node when it has only one
child. The definitions of them are very simple. First of all, draw a complete
binary tree (a tree whose nodes have e... | i ((,),(,)) ((,(,)),)
u ((,),(,)) ((,(,)),)
| ((,),)
((,(,)),(,))
| 23,282 |
s326552685 | p00587 | u260980560 | 1499880971 | Python | Python | py | Accepted | 10 | 6404 | 857 | def convert(s):
cur = [0]
def dfs():
result = [0, 0]
cur[0] += 1 # '('
if s[cur[0]] == '(':
result[0] = dfs()
cur[0] += 1 # ','
if s[cur[0]] == '(':
result[1] = dfs()
cur[0] += 1 # ')'
return result
return dfs()
def rconvert(C):... | p00587 |
<H1>Binary Tree Intersection And Union</H1>
<p>
Given two binary trees, we consider the “intersection” and “union” of them.
Here, we distinguish the left and right child of a node when it has only one
child. The definitions of them are very simple. First of all, draw a complete
binary tree (a tree whose nodes have e... | i ((,),(,)) ((,(,)),)
u ((,),(,)) ((,(,)),)
| ((,),)
((,(,)),(,))
| 23,283 |
s268588583 | p00587 | u600821328 | 1501152088 | Python | Python3 | py | Accepted | 30 | 7496 | 1,685 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
def tree_left(node, it):
c = next(it)
if c == "(":
node[0] = [None, None]
tree_left(node[0], it)
c = next(it)
if c == ",":
tree_right(node, it)
else:
assert False
def tree_right(node, it):
c = next... | p00587 |
<H1>Binary Tree Intersection And Union</H1>
<p>
Given two binary trees, we consider the “intersection” and “union” of them.
Here, we distinguish the left and right child of a node when it has only one
child. The definitions of them are very simple. First of all, draw a complete
binary tree (a tree whose nodes have e... | i ((,),(,)) ((,(,)),)
u ((,),(,)) ((,(,)),)
| ((,),)
((,(,)),(,))
| 23,284 |
s809842437 | p00587 | u266872031 | 1511368446 | Python | Python | py | Accepted | 20 | 6508 | 871 | def treeunprocess(tstr,lv):
d=0
if len(tstr)==0:
return []
for i in range(len(tstr)):
if tstr[i]=="(":
d+=1
elif tstr[i]==")":
d-=1
elif tstr[i]=="," and d==1:
return [lv]+treeunprocess(tstr[1:i], 2*lv+1) + treeunprocess(tstr[i+1:-1], 2*lv... | p00587 |
<H1>Binary Tree Intersection And Union</H1>
<p>
Given two binary trees, we consider the “intersection” and “union” of them.
Here, we distinguish the left and right child of a node when it has only one
child. The definitions of them are very simple. First of all, draw a complete
binary tree (a tree whose nodes have e... | i ((,),(,)) ((,(,)),)
u ((,),(,)) ((,(,)),)
| ((,),)
((,(,)),(,))
| 23,285 |
s351988540 | p00587 | u668489394 | 1579076157 | Python | Python3 | py | Accepted | 30 | 5588 | 2,195 | class Node:
def __init__(self, left, right):
self.left = left
self.right = right
self.val = ''
@classmethod
def fromString(cls, s):
pos = 1
if s[pos] == '(':
e = getEnd(s, 1)
left = cls.fromString(s[1:e+1])
pos = e + 2
... | p00587 |
<H1>Binary Tree Intersection And Union</H1>
<p>
Given two binary trees, we consider the “intersection” and “union” of them.
Here, we distinguish the left and right child of a node when it has only one
child. The definitions of them are very simple. First of all, draw a complete
binary tree (a tree whose nodes have e... | i ((,),(,)) ((,(,)),)
u ((,),(,)) ((,(,)),)
| ((,),)
((,(,)),(,))
| 23,286 |
s085652973 | p00587 | u316584871 | 1558102112 | Python | Python3 | py | Accepted | 40 | 6676 | 2,588 | import re
class bintree():
def __init__(self, str1):
self.str1 = str1
if self.str1[1] != ",":
c = 0
counter = 0
for s in str1[1:]:
counter += 1
if s == "(":
c += 1
elif s == ")":
... | p00587 |
<H1>Binary Tree Intersection And Union</H1>
<p>
Given two binary trees, we consider the “intersection” and “union” of them.
Here, we distinguish the left and right child of a node when it has only one
child. The definitions of them are very simple. First of all, draw a complete
binary tree (a tree whose nodes have e... | i ((,),(,)) ((,(,)),)
u ((,),(,)) ((,(,)),)
| ((,),)
((,(,)),(,))
| 23,287 |
s140452058 | p00587 | u943441430 | 1545030747 | Python | Python | py | Accepted | 10 | 4708 | 1,808 | import sys
def parse_btree(s):
l = r = -1
paren = 0
comma = -1
if s == "(,)":
return (["node"])
if s == "":
return (["None"])
for i in range(len(s)):
c = s[i]
if c == "(":
paren += 1
if paren == 1 and r < 0:
l = i
el... | p00587 |
<H1>Binary Tree Intersection And Union</H1>
<p>
Given two binary trees, we consider the “intersection” and “union” of them.
Here, we distinguish the left and right child of a node when it has only one
child. The definitions of them are very simple. First of all, draw a complete
binary tree (a tree whose nodes have e... | i ((,),(,)) ((,(,)),)
u ((,),(,)) ((,(,)),)
| ((,),)
((,(,)),(,))
| 23,288 |
s883978142 | p00587 | u467175809 | 1533198428 | Python | Python | py | Accepted | 10 | 5016 | 864 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
import math
sys.setrecursionlimit(10000000)
for line in sys.stdin:
op, S1, S2 = line.split()
id1 = id2 = 0
ans = ''
def rem(S, ind):
rem = '('
cnt = 1
while cnt > 0:
if S[ind... | p00587 |
<H1>Binary Tree Intersection And Union</H1>
<p>
Given two binary trees, we consider the “intersection” and “union” of them.
Here, we distinguish the left and right child of a node when it has only one
child. The definitions of them are very simple. First of all, draw a complete
binary tree (a tree whose nodes have e... | i ((,),(,)) ((,(,)),)
u ((,),(,)) ((,(,)),)
| ((,),)
((,(,)),(,))
| 23,289 |
s717058837 | p00587 | u847467233 | 1530738459 | Python | Python3 | py | Accepted | 20 | 5588 | 712 | # AOJ 1001: Binary Tree Intersection And Union
# Python3 2018.7.5 bal4u
def parse(p, i):
global sz
node[i][2] += 1
del p[0]
if p[0] != ',':
if node[i][0] == 0:
node[i][0] = sz
sz += 1
parse(p, node[i][0])
del p[0]
if p[0] != ')':
if node[i][1] == 0:
node[i][1] = sz
sz += 1
parse(p, node[i][1]... | p00587 |
<H1>Binary Tree Intersection And Union</H1>
<p>
Given two binary trees, we consider the “intersection” and “union” of them.
Here, we distinguish the left and right child of a node when it has only one
child. The definitions of them are very simple. First of all, draw a complete
binary tree (a tree whose nodes have e... | i ((,),(,)) ((,(,)),)
u ((,),(,)) ((,(,)),)
| ((,),)
((,(,)),(,))
| 23,290 |
s624386053 | p00588 | u266872031 | 1425661553 | Python | Python | py | Accepted | 80 | 5544 | 1,897 | def getAB(r,books,N):
if r==0:
return(books[2*r],books[2*(N+r)])
elif r==N:
return(books[2*r-1],books[2*(N+r)-1])
elif r==N+1:
return (1,0)
else:
return(books[2*r-1]|books[2*r],books[2*(N+r)-1]|books[2*(N+r)])
#def getcostandarray(A,B,array,r,books):
# ... | p00588 |
<H1>Extraordinary Girl (I)</H1>
<p>
She is an extraordinary girl. She works for a library. Since she is young
and cute, she is forced to do a lot of laborious jobs. The most annoying job
for her is to put returned books into shelves, carrying them by a cart. The
cart is large enough to carry many books, but too... | 2
2
YNNNNYYY
4
NYNNYYNNNYNYYNNN
| 6
9
| 23,291 |
s243284891 | p00588 | u467175809 | 1533199702 | Python | Python | py | Accepted | 60 | 5440 | 683 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
import math
sys.setrecursionlimit(10000000)
T = input()
for loop in range(T):
N = input()
S = raw_input()
S1 = 'N' + S[:N * 2] + 'N'
S2 = 'N' + S[N * 2:] + 'N'
sx1 = sx2 = 100000
gx1 = gx2 = -1
ans = 0
... | p00588 |
<H1>Extraordinary Girl (I)</H1>
<p>
She is an extraordinary girl. She works for a library. Since she is young
and cute, she is forced to do a lot of laborious jobs. The most annoying job
for her is to put returned books into shelves, carrying them by a cart. The
cart is large enough to carry many books, but too... | 2
2
YNNNNYYY
4
NYNNYYNNNYNYYNNN
| 6
9
| 23,292 |
s540387959 | p00589 | u633068244 | 1417602694 | Python | Python | py | Accepted | 10 | 4276 | 990 | alpha = ["","',.!?","abcABC","defDEF","ghiGHI","jklJKL","mnoMNO","pqrsPQRS","tuvTUV","wxyzWXYZ"]
while 1:
try:
ans = ""
sers = ""
c = 0
for key in raw_input():
if key == "0":
if len(sers) > 0:
n,l = int(sers[0]),len(sers)
... | p00589 |
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>problem</title>
</head>
<body bgcolor="#FFFFFF">
<link rel="stylesheet" href="../problem_e.css" type="text/css" />
-->
<H1>Extraordinary Girl (II)</H1>
<p>
She loves e-mail so much! She sends e-mails by her cellular phone t... | 666660666
44444416003334446633111
20202202000333003330333
| No
I'm fine.
aaba f ff
| 23,293 |
s323559196 | p00589 | u633068244 | 1417603690 | Python | Python | py | Accepted | 20 | 4244 | 695 | ref = ["",
"',.!?",
"abcABC",
"defDEF",
"ghiGHI",
"jklJKL",
"mnoMNO",
"pqrsPQRS",
"tuvTUV",
"wxyzWXYZ"]
def inp(s):
n = int(s[0])
p = (len(s)-1)%len(ref[n])
return ref[n][p]
while 1:
try:
pushes = raw_input()
except:
br... | p00589 |
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>problem</title>
</head>
<body bgcolor="#FFFFFF">
<link rel="stylesheet" href="../problem_e.css" type="text/css" />
-->
<H1>Extraordinary Girl (II)</H1>
<p>
She loves e-mail so much! She sends e-mails by her cellular phone t... | 666660666
44444416003334446633111
20202202000333003330333
| No
I'm fine.
aaba f ff
| 23,294 |
s044039385 | p00589 | u633068244 | 1417603701 | Python | Python | py | Accepted | 10 | 4244 | 695 | ref = ["",
"',.!?",
"abcABC",
"defDEF",
"ghiGHI",
"jklJKL",
"mnoMNO",
"pqrsPQRS",
"tuvTUV",
"wxyzWXYZ"]
def inp(s):
n = int(s[0])
p = (len(s)-1)%len(ref[n])
return ref[n][p]
while 1:
try:
pushes = raw_input()
except:
br... | p00589 |
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>problem</title>
</head>
<body bgcolor="#FFFFFF">
<link rel="stylesheet" href="../problem_e.css" type="text/css" />
-->
<H1>Extraordinary Girl (II)</H1>
<p>
She loves e-mail so much! She sends e-mails by her cellular phone t... | 666660666
44444416003334446633111
20202202000333003330333
| No
I'm fine.
aaba f ff
| 23,295 |
s672181586 | p00589 | u266872031 | 1428510468 | Python | Python | py | Accepted | 10 | 4280 | 1,030 | def getchar(button,num):
if button=='0':
return ' '*(num-1)
elif button=='1':
num=(num-1)%5
return "',.!?"[num]
elif button=='2':
num=(num-1)%6
return "abcABC"[num]
elif button=='3':
num=(num-1)%6
return "defDEF"[num]
elif button=='4':
... | p00589 |
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>problem</title>
</head>
<body bgcolor="#FFFFFF">
<link rel="stylesheet" href="../problem_e.css" type="text/css" />
-->
<H1>Extraordinary Girl (II)</H1>
<p>
She loves e-mail so much! She sends e-mails by her cellular phone t... | 666660666
44444416003334446633111
20202202000333003330333
| No
I'm fine.
aaba f ff
| 23,296 |
s010968028 | p00589 | u078042885 | 1484327760 | Python | Python3 | py | Accepted | 30 | 7644 | 587 | a=[['\'',',','.','!','?'],
['a','b','c','A','B','C'],
['d','e','f','D','E','F'],
['g','h','i','G','H','I'],
['j','k','l','J','K','L'],
['m','n','o','M','N','O'],
['p','q','r','s','P','Q','R','S'],
['t','u','v','T','U','V'],
['w','x','y','z','W','X','Y','Z']]
while 1:
try:b=input()+'@'
ex... | p00589 |
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>problem</title>
</head>
<body bgcolor="#FFFFFF">
<link rel="stylesheet" href="../problem_e.css" type="text/css" />
-->
<H1>Extraordinary Girl (II)</H1>
<p>
She loves e-mail so much! She sends e-mails by her cellular phone t... | 666660666
44444416003334446633111
20202202000333003330333
| No
I'm fine.
aaba f ff
| 23,297 |
s633996030 | p00589 | u797673668 | 1492414854 | Python | Python3 | py | Accepted | 30 | 7552 | 642 | import fileinput
chr_master = [
' ', '\',.!?', 'abcABC', 'defDEF', 'ghiGHI',
'jklJKL', 'mnoMNO', 'pqrsPQRS', 'tuvTUV', 'wxyzWXYZ'
]
for s in (line.strip() for line in fileinput.input()):
s += '!'
prev_c = None
cnt = 0
chr_list = []
for c in s:
if c == prev_c:
cnt += 1
... | p00589 |
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>problem</title>
</head>
<body bgcolor="#FFFFFF">
<link rel="stylesheet" href="../problem_e.css" type="text/css" />
-->
<H1>Extraordinary Girl (II)</H1>
<p>
She loves e-mail so much! She sends e-mails by her cellular phone t... | 666660666
44444416003334446633111
20202202000333003330333
| No
I'm fine.
aaba f ff
| 23,298 |
s977308001 | p00589 | u797673668 | 1492415085 | Python | Python3 | py | Accepted | 30 | 7488 | 579 | import fileinput
chr_master = [
' ', '\',.!?', 'abcABC', 'defDEF', 'ghiGHI',
'jklJKL', 'mnoMNO', 'pqrsPQRS', 'tuvTUV', 'wxyzWXYZ'
]
for s in (line.strip() for line in fileinput.input()):
s += '!'
prev_c = None
cnt = 0
ans = ''
for c in s:
if c == prev_c:
cnt += 1
... | p00589 |
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>problem</title>
</head>
<body bgcolor="#FFFFFF">
<link rel="stylesheet" href="../problem_e.css" type="text/css" />
-->
<H1>Extraordinary Girl (II)</H1>
<p>
She loves e-mail so much! She sends e-mails by her cellular phone t... | 666660666
44444416003334446633111
20202202000333003330333
| No
I'm fine.
aaba f ff
| 23,299 |
s691135554 | p00589 | u797673668 | 1492415208 | Python | Python3 | py | Accepted | 30 | 7536 | 518 | import fileinput
chr_master = [' ', '\',.!?', 'abcABC', 'defDEF', 'ghiGHI', 'jklJKL', 'mnoMNO', 'pqrsPQRS', 'tuvTUV', 'wxyzWXYZ']
for s in (line.strip() for line in fileinput.input()):
s += '!'
prev_c, cnt = 0, 1
ans = ''
for c in s:
if c == prev_c:
cnt += 1
continue
... | p00589 |
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>problem</title>
</head>
<body bgcolor="#FFFFFF">
<link rel="stylesheet" href="../problem_e.css" type="text/css" />
-->
<H1>Extraordinary Girl (II)</H1>
<p>
She loves e-mail so much! She sends e-mails by her cellular phone t... | 666660666
44444416003334446633111
20202202000333003330333
| No
I'm fine.
aaba f ff
| 23,300 |
s803344919 | p00589 | u847467233 | 1530702270 | Python | Python3 | py | Accepted | 30 | 5612 | 425 | # AOJ 1003: Extraordinary Girl II
# Python3 2018.7.4 bal4u
tbl = ["", "',.!?", "abcABC", "defDEF", "ghiGHI", "jklJKL", \
"mnoMNO", "pqrsPQRS", "tuvTUV", "wxyzWXYZ"]
while True:
try: s = input().strip()
except: break
ans, i = '', 0
while i < len(s):
c = s[i]
w, d, i = 0, int(c), i+1
while i < len(s) a... | p00589 |
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>problem</title>
</head>
<body bgcolor="#FFFFFF">
<link rel="stylesheet" href="../problem_e.css" type="text/css" />
-->
<H1>Extraordinary Girl (II)</H1>
<p>
She loves e-mail so much! She sends e-mails by her cellular phone t... | 666660666
44444416003334446633111
20202202000333003330333
| No
I'm fine.
aaba f ff
| 23,301 |
s348149894 | p00589 | u104911888 | 1370614842 | Python | Python | py | Accepted | 10 | 4256 | 600 | Button={
"1":"',.!?",
"2":"abcABC",
"3":"defDEF",
"4":"ghiGHI",
"5":"jklJKL",
"6":"mnoMNO",
"7":"pqrsPQRS",
"8":"tuvTUV",
"9":"wxyz",
"0":" "}
while True:
try:
sent=raw_input()
except EOFError:
break
init=sent[0]
cnt=1
ans=[]
for c in sent[1:]:
if c==init:
cn... | p00589 |
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>problem</title>
</head>
<body bgcolor="#FFFFFF">
<link rel="stylesheet" href="../problem_e.css" type="text/css" />
-->
<H1>Extraordinary Girl (II)</H1>
<p>
She loves e-mail so much! She sends e-mails by her cellular phone t... | 666660666
44444416003334446633111
20202202000333003330333
| No
I'm fine.
aaba f ff
| 23,302 |
s079757762 | p00589 | u590037228 | 1393919092 | Python | Python | py | Accepted | 10 | 4292 | 1,934 | #-*- coding:utf-8 -*-
import sys
#入力されたデータに関して携帯のキーを返す
def decode_keitai(str):
#携帯キーを表す配列を作成
keitai_keys = [" ","',.!?","abcABC","defDEF","ghiGHI","jklJKL","mnoMNO","pqrsPQRS","tuvTUV","wxyzWXYZ"]
#結果文字列
results = []
#入力文字列をリストに変換
inputs = str.split("\n")
#各文字列について
for input in inpu... | p00589 |
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>problem</title>
</head>
<body bgcolor="#FFFFFF">
<link rel="stylesheet" href="../problem_e.css" type="text/css" />
-->
<H1>Extraordinary Girl (II)</H1>
<p>
She loves e-mail so much! She sends e-mails by her cellular phone t... | 666660666
44444416003334446633111
20202202000333003330333
| No
I'm fine.
aaba f ff
| 23,303 |
s054628009 | p00589 | u260980560 | 1583166449 | Python | Python3 | py | Accepted | 30 | 5604 | 681 | T = [
None,
"',.!?",
"abcABC",
"defDEF",
"ghiGHI",
"jklJKL",
"mnoMNO",
"pqrsPQRS",
"tuvTUV",
"wxyzWXYZ",
]
try:
while 1:
ans = []
*S, = map(int, input())
S.append(0)
prv = 0
cur = -1
for c in S:
if c == prv:
... | p00589 |
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>problem</title>
</head>
<body bgcolor="#FFFFFF">
<link rel="stylesheet" href="../problem_e.css" type="text/css" />
-->
<H1>Extraordinary Girl (II)</H1>
<p>
She loves e-mail so much! She sends e-mails by her cellular phone t... | 666660666
44444416003334446633111
20202202000333003330333
| No
I'm fine.
aaba f ff
| 23,304 |
s467566057 | p00589 | u467175809 | 1533274338 | Python | Python | py | Accepted | 10 | 5016 | 591 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
import math
sys.setrecursionlimit(10000000)
S = ["", "',.!?", "abcABC", "defDEF", "ghiGHI",
"jklJKL", "mnoMNO", "pqrsPQRS", "tuvTUV", "wxyzWXYZ"]
for line in sys.stdin:
ans = ''
k = 0
cnt = 0
line = list(line)
... | p00589 |
<!--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>problem</title>
</head>
<body bgcolor="#FFFFFF">
<link rel="stylesheet" href="../problem_e.css" type="text/css" />
-->
<H1>Extraordinary Girl (II)</H1>
<p>
She loves e-mail so much! She sends e-mails by her cellular phone t... | 666660666
44444416003334446633111
20202202000333003330333
| No
I'm fine.
aaba f ff
| 23,305 |
s838179137 | p00591 | u797673668 | 1460963359 | Python | Python3 | py | Accepted | 30 | 7628 | 323 | while True:
n = int(input())
if not n: break
a = [list(map(int, input().split())) for _ in range(n)]
s = max(min(a[i]) for i in range(n))
c = [max(a[i][j] for i in range(n)) for j in range(n)]
for j in range(n):
if c[j] == s:
print(s)
break
else:
print... | p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,306 |
s566724537 | p00591 | u221679506 | 1467934602 | Python | Python3 | py | Accepted | 30 | 7740 | 431 | while True:
n = int(input())
if not n:
break
#map???????????£????????£??¨????????????????°???????????????????????????????????????¨
f = [[int(j) for j in input().split()] for i in range(n)]
ans = max(min(f[i]) for i in range(n))
tans = [max(f[i][j] for i in range(n)) for j in range(n)]
... | p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,307 |
s919473257 | p00591 | u766597310 | 1477679966 | Python | Python | py | Accepted | 10 | 6268 | 476 | while 1:
n = input()
if (n == 0): break
a = [[0] * n] * n
for i in range(n):
a[i] = map(int, raw_input().split())
ans = 0
for i in range(n):
c = 0
for j in range(n):
if (a[i][j] < a[i][c]):
c = j
f = 1
for i2 in range(n):
... | p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,308 |
s547085821 | p00591 | u266872031 | 1485706866 | Python | Python | py | Accepted | 10 | 6324 | 566 | while(1):
n=int(raw_input())
if n==0: break
A=[]
for i in range(n):
A.append(map(int,raw_input().split()))
B=[ [A[i][j] for i in range(n)] for j in range(n) ]
ans=0
for i in range(n):
ma=min(A[i])
m=A[i].count(ma)
mlist=[]
for k in range(m):
... | p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,309 |
s925137112 | p00591 | u922489088 | 1503915640 | Python | Python3 | py | Accepted | 20 | 7672 | 543 | import sys
while True:
n = int(sys.stdin.readline().rstrip())
if n == 0:
break;
students = []
for i in range(n):
students.append(list(map(int, sys.stdin.readline().rstrip().split(' '))))
s_list=[[min(row)==s for s in row] for row in students]
t_list=[[max(col)==s for s in col] f... | p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,310 |
s084131510 | p00591 | u922489088 | 1503915655 | Python | Python | py | Accepted | 10 | 6256 | 543 | import sys
while True:
n = int(sys.stdin.readline().rstrip())
if n == 0:
break;
students = []
for i in range(n):
students.append(list(map(int, sys.stdin.readline().rstrip().split(' '))))
s_list=[[min(row)==s for s in row] for row in students]
t_list=[[max(col)==s for s in col] f... | p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,311 |
s713228825 | p00591 | u009288816 | 1520077779 | Python | Python3 | py | Accepted | 20 | 5612 | 1,121 | import sys
def get_min_value_in_row(data):
if(len(data) < 1):
return 0
min = 0
for i in range(0,len(data)):
if(data[i] < data[min]):
min = i
return min
def is_max(Min,index,data):
max = data[index][Min]
for i in range(index,-1,-1):
if(data[i][Min] > max):
... | p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,312 |
s529762679 | p00591 | u104911888 | 1368080672 | Python | Python | py | Accepted | 10 | 4224 | 282 | while True:
n=input()
if n==0:break
L=[map(int,raw_input().split()) for i in range(n)]
S=set([min(i) for i in L])
for t in [[i[j] for i in L] for j in range(n)]:
maxInt=max(t)
if maxInt in S:
print maxInt
break
else:
print 0 | p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,313 |
s838404070 | p00591 | u590037228 | 1393983731 | Python | Python | py | Accepted | 20 | 4224 | 467 | #-*- coding:utf-8 -*-
while 1:
n = int(raw_input())
if not n:
break
columns = []
for i in range(n):
columns.append([])
rows = []
for i in range(n):
row = [int(r) for r in raw_input().split(" ")]
rows.append(min(row))
for i in range(n):
columns... | p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,314 |
s978805524 | p00591 | u617183767 | 1393994931 | Python | Python | py | Accepted | 20 | 4228 | 509 | # -*- coding: utf-8 -*-
while True:
n = int(raw_input())
if n == 0:
break
columns = []
for i in range(n):
columns.append([])
maxrows = []
for i in range(n):
row = map(int, raw_input().split())
maxrows.append(min(row))
for j in range(n):
col... | p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,315 |
s707557666 | p00591 | u633068244 | 1397011373 | Python | Python | py | Accepted | 10 | 4220 | 234 | while 1:
n=input()
if n==0:break
s=[map(int,raw_input().split()) for i in range(n)]
sh=set([min(s[i]) for i in range(n)])
tl=set([max([s[j][i] for j in range(n)]) for i in range(n)])
print list(sh&tl)[0] if len(sh&tl)>0 else 0
| p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,316 |
s316287970 | p00591 | u467175809 | 1533207011 | Python | Python | py | Accepted | 10 | 4656 | 179 | n=1
while n>0:
n=input();r=range(n)
if n>0:A=[map(int,raw_input().split())for i in r];a={min(A[i])for i in r}&{max(A[j][i]for j in r)for i in r};print a.pop()if len(a)>0 else 0
| p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,317 |
s670645414 | p00591 | u260980560 | 1533047381 | Python | Python3 | py | Accepted | 30 | 5600 | 300 | while 1:
N = int(input())
if N == 0:
break
S = [list(map(int, input().split())) for i in range(N)]
B = {max(S[i][j] for i in range(N)) for j in range(N)} & {min(S[i][j] for j in range(N)) for i in range(N)}
if B:
e, = B
print(e)
else:
print(0)
| p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,318 |
s773809475 | p00591 | u847467233 | 1530750870 | Python | Python3 | py | Accepted | 20 | 5616 | 575 | # AOJ 1005: Advanced Algorithm Class
# Python3 2018.7.5 bal4u
import sys
from sys import stdin
input = stdin.readline
while True:
n = int(input())
if n == 0: break
a = [list(map(int, input().split())) for r in range(n)]
b = [[0 for c in range(n)] for r in range(n)]
for r in range(n):
mi = min(a[r])
for c in ... | p00591 |
<H1>Advanced Algorithm Class</H1>
<p>
In the advanced algorithm class, n<sup>2</sup> students sit in n rows and
n columns. One day, a professor who teaches this subject comes into the class, asks the shortest student in each row to lift up his left hand, and the tallest student in each column to lift up his right... | 3
1 2 3
4 5 6
7 8 9
3
1 2 3
7 8 9
4 5 6
0
| 7
7
| 23,319 |
s117293797 | p00592 | u703196441 | 1418469498 | Python | Python | py | Accepted | 20 | 4276 | 353 | def cv(t):
return t/100*60+t%100
while 1:
n,p,q = map(int,raw_input().split())
if n==0: break
v=[0]*1440
for i in range(n):
k = int(raw_input())
a = map(int,raw_input().split())
for j in range(k):
for l in range(cv(a[::2][j]),cv(a[1::2][j])):
v[l]+=1
m=c=0
for i in range(cv(p),cv(q)):
c=c+1 if v[... | p00592 |
<H1>Boring Commercial</H1>
<p>
Now it is spring holidays. A lazy student has finally passed all final examination, and he decided to just kick back and just watch TV all day. Oh, his
only source of entertainment is watching TV. And TV commercial, as usual, are
a big nuisance for him. He can watch any thing on ... | 1 2100 2400
1
2130 2200
3 2100 2400
3
2100 2130 2200 2230 2300 2330
2
2130 2200 2330 2400
2
2100 2130 2330 2400
0 0 0
| 120
180
| 23,320 |
s794153671 | p00592 | u703196441 | 1418470307 | Python | Python | py | Accepted | 10 | 4276 | 333 | def get():
return map(int,raw_input().split())
def cv(t):
return t/100*60+t%100
while 1:
n,p,q=get()
if n==0: break
v=[0]*1440
for i in range(n):
k=get()[0]; a=get()
for j in range(k):
for l in range(cv(a[::2][j]),cv(a[1::2][j])):
v[l]+=1
m=c=0
for i in range(cv(p),cv(q)):
c=(c+1)*(v[i]<n)
m=max(... | p00592 |
<H1>Boring Commercial</H1>
<p>
Now it is spring holidays. A lazy student has finally passed all final examination, and he decided to just kick back and just watch TV all day. Oh, his
only source of entertainment is watching TV. And TV commercial, as usual, are
a big nuisance for him. He can watch any thing on ... | 1 2100 2400
1
2130 2200
3 2100 2400
3
2100 2130 2200 2230 2300 2330
2
2130 2200 2330 2400
2
2100 2130 2330 2400
0 0 0
| 120
180
| 23,321 |
s004504177 | p00592 | u266872031 | 1428590214 | Python | Python | py | Accepted | 20 | 4288 | 1,095 | def tt(o,t):
om=o%100
oh=o/100
tm=t%100
th=t/100
return tm-om+(th-oh)*60
while(1):
[c,s,e]=[int(x) for x in raw_input().split()]
if c==0:
break
else:
cmlist=[]
timelist=[s]
state=2**c-1
oldtime=s
oldstate=0
ans=0
tempt... | p00592 |
<H1>Boring Commercial</H1>
<p>
Now it is spring holidays. A lazy student has finally passed all final examination, and he decided to just kick back and just watch TV all day. Oh, his
only source of entertainment is watching TV. And TV commercial, as usual, are
a big nuisance for him. He can watch any thing on ... | 1 2100 2400
1
2130 2200
3 2100 2400
3
2100 2130 2200 2230 2300 2330
2
2130 2200 2330 2400
2
2100 2130 2330 2400
0 0 0
| 120
180
| 23,322 |
s804126709 | p00592 | u077582668 | 1446223626 | Python | Python | py | Accepted | 10 | 6452 | 898 | #while 1:
#n=map(int,raw_input().split())
def chang(x):
h = x / 100
m= x%100
return h * 60 + m
while 1:
(ch,st,en) = map(int, raw_input().split())
if(ch==0 and st ==0 and en ==0):break
hours = [0]*(chang(2400)+1)
for i in range(ch):
line = raw_input()
tms = map(int, raw... | p00592 |
<H1>Boring Commercial</H1>
<p>
Now it is spring holidays. A lazy student has finally passed all final examination, and he decided to just kick back and just watch TV all day. Oh, his
only source of entertainment is watching TV. And TV commercial, as usual, are
a big nuisance for him. He can watch any thing on ... | 1 2100 2400
1
2130 2200
3 2100 2400
3
2100 2130 2200 2230 2300 2330
2
2130 2200 2330 2400
2
2100 2130 2330 2400
0 0 0
| 120
180
| 23,323 |
s172903102 | p00592 | u221679506 | 1467945895 | Python | Python3 | py | Accepted | 30 | 7616 | 730 | while True:
n,s,e = input().split()
n = int(n)
s = int(s)
e = int(e)
if not n+s+e:
break
s = s//100*60+s%100
e = e//100*60+e%100
t = [0]*(60*24+1)
for i in range(n):
m = int(input())
g = input().split()
j = 0
for o in g:
a = int(o)
... | p00592 |
<H1>Boring Commercial</H1>
<p>
Now it is spring holidays. A lazy student has finally passed all final examination, and he decided to just kick back and just watch TV all day. Oh, his
only source of entertainment is watching TV. And TV commercial, as usual, are
a big nuisance for him. He can watch any thing on ... | 1 2100 2400
1
2130 2200
3 2100 2400
3
2100 2130 2200 2230 2300 2330
2
2130 2200 2330 2400
2
2100 2130 2330 2400
0 0 0
| 120
180
| 23,324 |
s922198923 | p00592 | u590037228 | 1393991769 | Python | Python | py | Accepted | 20 | 4308 | 1,615 | #-*- coding:utf-8 -*-
#入力数値を分単位に変更
def convert_time(n):
return (n/100)*60 + n%100
#コマーシャルの共通部分を返す
def kyotsu(cm1,cm2):
result = []
for i in range(len(cm2)/2):
#cm2の各CMとかぶっている部分を取得
for j in range(len(cm1)/2):
stt = max(cm2[i*2],cm1[j*2])
edt = min(cm2[i*2+1],cm1[j*2+... | p00592 |
<H1>Boring Commercial</H1>
<p>
Now it is spring holidays. A lazy student has finally passed all final examination, and he decided to just kick back and just watch TV all day. Oh, his
only source of entertainment is watching TV. And TV commercial, as usual, are
a big nuisance for him. He can watch any thing on ... | 1 2100 2400
1
2130 2200
3 2100 2400
3
2100 2130 2200 2230 2300 2330
2
2130 2200 2330 2400
2
2100 2130 2330 2400
0 0 0
| 120
180
| 23,325 |
s564742601 | p00592 | u467175809 | 1533275899 | Python | Python | py | Accepted | 10 | 5136 | 787 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
import math
sys.setrecursionlimit(10000000)
while True:
n, p, q = map(int, raw_input().split())
if n == p == q == 0:
break
T = [0 for i in range(2401)]
for loop in range(n):
k = input()
ts = ... | p00592 |
<H1>Boring Commercial</H1>
<p>
Now it is spring holidays. A lazy student has finally passed all final examination, and he decided to just kick back and just watch TV all day. Oh, his
only source of entertainment is watching TV. And TV commercial, as usual, are
a big nuisance for him. He can watch any thing on ... | 1 2100 2400
1
2130 2200
3 2100 2400
3
2100 2130 2200 2230 2300 2330
2
2130 2200 2330 2400
2
2100 2130 2330 2400
0 0 0
| 120
180
| 23,326 |
s502493151 | p00592 | u260980560 | 1533048164 | Python | Python3 | py | Accepted | 20 | 5600 | 587 | conv = lambda t: (t // 100)*60 + (t % 100)
while 1:
N, P, Q = map(int, input().split())
if N == P == Q == 0:
break
P = conv(P); Q = conv(Q)
CM = [0]*(Q-P+1)
for i in range(N):
k = int(input())
*T, = map(int, input().split())
for s, t in zip(T[::2], T[1::2]):
... | p00592 |
<H1>Boring Commercial</H1>
<p>
Now it is spring holidays. A lazy student has finally passed all final examination, and he decided to just kick back and just watch TV all day. Oh, his
only source of entertainment is watching TV. And TV commercial, as usual, are
a big nuisance for him. He can watch any thing on ... | 1 2100 2400
1
2130 2200
3 2100 2400
3
2100 2130 2200 2230 2300 2330
2
2130 2200 2330 2400
2
2100 2130 2330 2400
0 0 0
| 120
180
| 23,327 |
s368376049 | p00592 | u847467233 | 1530751812 | Python | Python3 | py | Accepted | 30 | 5624 | 583 | # AOJ 1006: Boring Commercials
# Python3 2018.7.5 bal4u
import sys
from sys import stdin
input = stdin.readline
def d2t(d): return (d//100)*60 + (d%100)
while True:
n, p, q = map(int, input().split())
if n == 0: break
tbl = [0]*1500
p, q = d2t(p), d2t(q)
for i in range(n):
k = 2*int(input())
a = list(map(in... | p00592 |
<H1>Boring Commercial</H1>
<p>
Now it is spring holidays. A lazy student has finally passed all final examination, and he decided to just kick back and just watch TV all day. Oh, his
only source of entertainment is watching TV. And TV commercial, as usual, are
a big nuisance for him. He can watch any thing on ... | 1 2100 2400
1
2130 2200
3 2100 2400
3
2100 2130 2200 2230 2300 2330
2
2130 2200 2330 2400
2
2100 2130 2330 2400
0 0 0
| 120
180
| 23,328 |
s592159297 | p00593 | u879226672 | 1427907045 | Python | Python | py | Accepted | 20 | 4264 | 766 | case = 1
while True:
N = int(raw_input())
if N == 0: break
mat = [[0 for i in range(N)] for j in range(N)]
n = 1
for i in range(N): # upper half
for j in range(i,-1,-1):
if i%2==0:
mat[j][i-j] = n
n += 1
elif i%2==1:
... | p00593 |
<H1>JPEG Compression</H1>
<p>
The fundamental idea in the JPEG compression algorithm is to sort coeffi-
cient of given image by zigzag path and encode it. In this problem, we don’t
discuss about details of the algorithm, but you are asked to make simple pro-
gram. You are given single integer N , and you must o... | 3
4
0
| Case 1:
1 2 6
3 5 7
4 8 9
Case 2:
1 2 6 7
3 5 8 13
4 9 12 14
10 11 15 16
| 23,329 |
s666937352 | p00593 | u879226672 | 1433652855 | Python | Python | py | Accepted | 10 | 4268 | 781 | # coding: utf-8
# Here your code !
case = 1
while True:
N = int(raw_input())
if N == 0: break
mat = [[0 for i in xrange(N)] for j in xrange(N)]
n = 1
for i in range(N): # upper half
for j in reversed(xrange(i+1)):
if i%2==0:
mat[j][i-j] = n
n += 1
... | p00593 |
<H1>JPEG Compression</H1>
<p>
The fundamental idea in the JPEG compression algorithm is to sort coeffi-
cient of given image by zigzag path and encode it. In this problem, we don’t
discuss about details of the algorithm, but you are asked to make simple pro-
gram. You are given single integer N , and you must o... | 3
4
0
| Case 1:
1 2 6
3 5 7
4 8 9
Case 2:
1 2 6 7
3 5 8 13
4 9 12 14
10 11 15 16
| 23,330 |
s613540193 | p00593 | u879226672 | 1433653057 | Python | Python | py | Accepted | 10 | 4268 | 788 | # coding: utf-8
# Here your code !
case = 1
while True:
N = int(raw_input())
if N == 0: break
mat = [[0 for i in xrange(N)] for j in xrange(N)]
n = 1
for i in xrange(N): # upper half
for j in reversed(xrange(i+1)):
if i%2==0:
mat[j][i-j] = n
n += 1... | p00593 |
<H1>JPEG Compression</H1>
<p>
The fundamental idea in the JPEG compression algorithm is to sort coeffi-
cient of given image by zigzag path and encode it. In this problem, we don’t
discuss about details of the algorithm, but you are asked to make simple pro-
gram. You are given single integer N , and you must o... | 3
4
0
| Case 1:
1 2 6
3 5 7
4 8 9
Case 2:
1 2 6 7
3 5 8 13
4 9 12 14
10 11 15 16
| 23,331 |
s618436118 | p00593 | u879226672 | 1433653123 | Python | Python | py | Accepted | 10 | 4268 | 769 | # coding: utf-8
case = 1
while True:
N = int(raw_input())
if N == 0: break
mat = [[0 for i in xrange(N)] for j in xrange(N)]
n = 1
for i in xrange(N): # upper half
for j in reversed(xrange(i+1)):
if i%2==0:
mat[j][i-j] = n
n += 1
elif i... | p00593 |
<H1>JPEG Compression</H1>
<p>
The fundamental idea in the JPEG compression algorithm is to sort coeffi-
cient of given image by zigzag path and encode it. In this problem, we don’t
discuss about details of the algorithm, but you are asked to make simple pro-
gram. You are given single integer N , and you must o... | 3
4
0
| Case 1:
1 2 6
3 5 7
4 8 9
Case 2:
1 2 6 7
3 5 8 13
4 9 12 14
10 11 15 16
| 23,332 |
s063594220 | p00593 | u077582668 | 1446225343 | Python | Python | py | Accepted | 10 | 6376 | 938 | #while 1:
#n=map(int,raw_input().split())
otehon = [[1,2,6,7,15,16,28,29,45],
[3,5,8,14,17,27,30,44],
[4,9,13,18,26,31,43],
[10,12,19,25,32,42],
[11,20,24,33,41],
[21,23,34,40],
[22,35,39],
[36,38],
[37]]
def xyz(num):
num = str(... | p00593 |
<H1>JPEG Compression</H1>
<p>
The fundamental idea in the JPEG compression algorithm is to sort coeffi-
cient of given image by zigzag path and encode it. In this problem, we don’t
discuss about details of the algorithm, but you are asked to make simple pro-
gram. You are given single integer N , and you must o... | 3
4
0
| Case 1:
1 2 6
3 5 7
4 8 9
Case 2:
1 2 6 7
3 5 8 13
4 9 12 14
10 11 15 16
| 23,333 |
s808678391 | p00593 | u797673668 | 1456688862 | Python | Python3 | py | Accepted | 20 | 7612 | 567 | case = 1
while True:
n = int(input())
if not n:
break
jpeg = [[0] * n for _ in range(n)]
n1 = n - 1
px, cur = [0, 0], 1
while px[0] < n:
i, j = px
jpeg[i][j] = cur
odd = (i + j) % 2
if px[not odd] == n1:
px[odd] += 1
elif not px[odd]:
... | p00593 |
<H1>JPEG Compression</H1>
<p>
The fundamental idea in the JPEG compression algorithm is to sort coeffi-
cient of given image by zigzag path and encode it. In this problem, we don’t
discuss about details of the algorithm, but you are asked to make simple pro-
gram. You are given single integer N , and you must o... | 3
4
0
| Case 1:
1 2 6
3 5 7
4 8 9
Case 2:
1 2 6 7
3 5 8 13
4 9 12 14
10 11 15 16
| 23,334 |
s444864007 | p00593 | u266872031 | 1482936267 | Python | Python | py | Accepted | 10 | 6428 | 626 |
q=1
while(1):
n=int(raw_input())
if n==0: break
A=[[0 for i in range(n)] for i in range(n)]
up=1
m=1
for i in range(n):
for j in range(i+1):
if up:
A[i-j][j]=m
else:
A[j][i-j]=m
m+=1
up=not up
for i in r... | p00593 |
<H1>JPEG Compression</H1>
<p>
The fundamental idea in the JPEG compression algorithm is to sort coeffi-
cient of given image by zigzag path and encode it. In this problem, we don’t
discuss about details of the algorithm, but you are asked to make simple pro-
gram. You are given single integer N , and you must o... | 3
4
0
| Case 1:
1 2 6
3 5 7
4 8 9
Case 2:
1 2 6 7
3 5 8 13
4 9 12 14
10 11 15 16
| 23,335 |
s351775801 | p00593 | u133119785 | 1511956562 | Python | Python3 | py | Accepted | 20 | 5652 | 1,211 | import sys
def p(t):
for l in t:
for n in l:
print("{0:>3}".format(n),end="")
print("")
c = 0
for n in sys.stdin:
n = int(n)
if n == 0:
break
t = [ [ 0 for _ in range(n) ] for _ in range(n) ]
c += 1
print("Case {}:".format(c))
x = 0
y = 0
up=... | p00593 |
<H1>JPEG Compression</H1>
<p>
The fundamental idea in the JPEG compression algorithm is to sort coeffi-
cient of given image by zigzag path and encode it. In this problem, we don’t
discuss about details of the algorithm, but you are asked to make simple pro-
gram. You are given single integer N , and you must o... | 3
4
0
| Case 1:
1 2 6
3 5 7
4 8 9
Case 2:
1 2 6 7
3 5 8 13
4 9 12 14
10 11 15 16
| 23,336 |
s759276374 | p00593 | u104911888 | 1371001286 | Python | Python | py | Accepted | 20 | 4296 | 843 | case=1
while True:
n=input()
if n==0:break
value=1
grid=[[0]*n for i in range(n)]
x=y=0
if n==1:
grid[y][x]=1
while value<n*n:
grid[y][x]=value
if x<n-1:
x+=1
value+=1
grid[y][x]=value
else:
y+=1
valu... | p00593 |
<H1>JPEG Compression</H1>
<p>
The fundamental idea in the JPEG compression algorithm is to sort coeffi-
cient of given image by zigzag path and encode it. In this problem, we don’t
discuss about details of the algorithm, but you are asked to make simple pro-
gram. You are given single integer N , and you must o... | 3
4
0
| Case 1:
1 2 6
3 5 7
4 8 9
Case 2:
1 2 6 7
3 5 8 13
4 9 12 14
10 11 15 16
| 23,337 |
s262405839 | p00593 | u668489394 | 1579132607 | Python | Python3 | py | Accepted | 20 | 5636 | 1,847 | if __name__ == '__main__':
TC = 1
while True:
N = int(input())
if N == 0:
break
arr = [ [ 0 for _ in range(N) ] for _ in range(N) ]
i = 0
j = 0
val = 1
prevMove = "UR"
while True:
arr[i][j] = val
val += 1
... | p00593 |
<H1>JPEG Compression</H1>
<p>
The fundamental idea in the JPEG compression algorithm is to sort coeffi-
cient of given image by zigzag path and encode it. In this problem, we don’t
discuss about details of the algorithm, but you are asked to make simple pro-
gram. You are given single integer N , and you must o... | 3
4
0
| Case 1:
1 2 6
3 5 7
4 8 9
Case 2:
1 2 6 7
3 5 8 13
4 9 12 14
10 11 15 16
| 23,338 |
s380941603 | p00593 | u467175809 | 1533276776 | Python | Python | py | Accepted | 10 | 5028 | 659 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
import math
sys.setrecursionlimit(10000000)
for hoge in range(1, 100):
n = input()
if n == 0:
break
s, t = 1 - n, 1
cnt = 1
sign = -1
A = ['' for i in range(n)]
for loop in range(n * 3):
... | p00593 |
<H1>JPEG Compression</H1>
<p>
The fundamental idea in the JPEG compression algorithm is to sort coeffi-
cient of given image by zigzag path and encode it. In this problem, we don’t
discuss about details of the algorithm, but you are asked to make simple pro-
gram. You are given single integer N , and you must o... | 3
4
0
| Case 1:
1 2 6
3 5 7
4 8 9
Case 2:
1 2 6 7
3 5 8 13
4 9 12 14
10 11 15 16
| 23,339 |
s149859515 | p00593 | u260980560 | 1533048898 | Python | Python3 | py | Accepted | 20 | 5604 | 403 | t = 1
while 1:
N = int(input())
if N == 0:
break
print("Case %d:" % t); t += 1
M = [[0]*N for i in range(N)]
c = 1
for i in range(2*N-1):
for j in range(max(i-N+1, 0), min(N, i+1)):
if i % 2 == 0:
M[i-j][j] = "%3d" % c
else:
... | p00593 |
<H1>JPEG Compression</H1>
<p>
The fundamental idea in the JPEG compression algorithm is to sort coeffi-
cient of given image by zigzag path and encode it. In this problem, we don’t
discuss about details of the algorithm, but you are asked to make simple pro-
gram. You are given single integer N , and you must o... | 3
4
0
| Case 1:
1 2 6
3 5 7
4 8 9
Case 2:
1 2 6 7
3 5 8 13
4 9 12 14
10 11 15 16
| 23,340 |
s149879901 | p00593 | u847467233 | 1530761837 | Python | Python3 | py | Accepted | 30 | 5660 | 756 | # AOJ 1007: JPEG Compression
# Python3 2018.7.5 bal4u
import sys
from sys import stdin
input = stdin.readline
cno = 0
while True:
n = int(input())
if n == 0: break
cno += 1
a = [[0 for j in range(12)] for i in range(12)]
m = k = f = 1;
while True:
if f:
for r in range(k-1, -1, -1):
a[r][k-1-r] = m
... | p00593 |
<H1>JPEG Compression</H1>
<p>
The fundamental idea in the JPEG compression algorithm is to sort coeffi-
cient of given image by zigzag path and encode it. In this problem, we don’t
discuss about details of the algorithm, but you are asked to make simple pro-
gram. You are given single integer N , and you must o... | 3
4
0
| Case 1:
1 2 6
3 5 7
4 8 9
Case 2:
1 2 6 7
3 5 8 13
4 9 12 14
10 11 15 16
| 23,341 |
s386184267 | p00595 | u879226672 | 1427988117 | Python | Python | py | Accepted | 20 | 4200 | 208 | def gcd(m,n):
while m%n>0:
m,n=n,m%n
else:
return n
while True:
try:
m,n = map(int,raw_input().split())
print gcd(m,n)
except EOFError:
break | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,342 |
s448747029 | p00595 | u811434779 | 1445777490 | Python | Python | py | Accepted | 20 | 7928 | 138 | from fractions import gcd
while 1:
try:
a, b = map(int, raw_input().split())
print gcd(a, b)
except:
break | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,343 |
s594216074 | p00595 | u489809100 | 1447923984 | Python | Python | py | Accepted | 10 | 6452 | 301 | def greatestCommonDivisor(num1, num2):
if num1 % num2 == 0 : return num2
return num1 % num2
while True:
try:
a,b = map(int,raw_input().split())
except EOFError:
break
while a != b:
if a > b:
a = greatestCommonDivisor(a, b)
elif b > a:
b = greatestCommonDivisor(b, a)
print a | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,344 |
s294277734 | p00595 | u546285759 | 1484024612 | Python | Python3 | py | Accepted | 20 | 7660 | 149 | while True:
try:
a, b= map(int, input().split())
while b!= 0:
a, b= b, a%b
print(a)
except:
break | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,345 |
s717936097 | p00595 | u078042885 | 1484567012 | Python | Python3 | py | Accepted | 20 | 7612 | 97 | while 1:
try:a,b=map(int,input().split())
except:break
while b:a,b=b,a%b
print(a) | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,346 |
s282119943 | p00595 | u797673668 | 1492413426 | Python | Python3 | py | Accepted | 20 | 7508 | 169 | import fileinput
for a, b in (map(int, line.split()) for line in fileinput.input()):
if a > b:
a, b = b, a
while a:
a, b = b % a, a
print(b) | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,347 |
s796485569 | p00595 | u662126750 | 1497369112 | Python | Python3 | py | Accepted | 20 | 7644 | 244 | def gcd(x, y):
if y==0: return x
z = x % y
return gcd(y, z)
while True:
try:
a, b = (int(i) for i in input().split())
except EOFError:
break
if a<b: print(gcd(b,a))
else: print(gcd(a,b))
| p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,348 |
s982834447 | p00595 | u811733736 | 1507951998 | Python | Python3 | py | Accepted | 60 | 10212 | 273 | # -*- coding: utf-8 -*-
"""
"""
import sys
from sys import stdin
import fractions
input = stdin.readline
def main(args):
for line in stdin:
n, m = map(int, line.split())
print(fractions.gcd(n, m))
if __name__ == '__main__':
main(sys.argv[1:]) | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,349 |
s858941424 | p00595 | u471400255 | 1513672907 | Python | Python3 | py | Accepted | 30 | 5668 | 123 | from math import gcd
from sys import stdin
for line in stdin:
a,b = [int(i) for i in line.split()]
print(gcd(a,b)) | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,350 |
s814310883 | p00595 | u009288816 | 1521975560 | Python | Python3 | py | Accepted | 30 | 5604 | 219 | import sys
def gcd(a,b):
if(b):
return gcd(b,(a%b))
else:
return a
List = []
for i in sys.stdin:
List.append(i)
for data in List:
print(gcd(int(data.split()[0]),int(data.split()[1])))
| p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,351 |
s372090872 | p00595 | u043254318 | 1526318571 | Python | Python3 | py | Accepted | 30 | 5660 | 252 | import math
def get_input():
while True:
try:
yield ''.join(input())
except EOFError:
break
N = list(get_input())
for l in range(len(N)):
a,b = [int(i) for i in N[l].split()]
print(math.gcd(a, b))
| p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,352 |
s710057970 | p00595 | u724548524 | 1526725330 | Python | Python3 | py | Accepted | 30 | 5596 | 207 | import sys
for e in sys.stdin:
p, q = map(int, e.split())
if p < q:p, q = q, p
while True:
if p % q == 0:
print(q)
break
else:
p, q = q, p % q
| p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,353 |
s563283091 | p00595 | u847467233 | 1530705234 | Python | Python3 | py | Accepted | 20 | 5596 | 213 | # AOJ 1009: Greatest Common Divisor
# Python3 2018.7.4 bal4u
def gcd(a, b):
while b != 0:
r = a % b
a, b = b, r
return a
while True:
try: a, b = map(int, input().split())
except: break
print(gcd(a, b))
| p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,354 |
s759151577 | p00595 | u460331583 | 1346006903 | Python | Python | py | Accepted | 20 | 4220 | 234 | def gcd(a,b):
if b == 0:
return a
else:
return gcd(b ,a%b)
def lcm(a,b):
return a*b / gcd(a,b)
while True:
try:
a = map(int,raw_input().split())
a,b = a[0],a[1]
print gcd(a,b)
except EOFError:
break | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,355 |
s120362366 | p00595 | u894941280 | 1346006911 | Python | Python | py | Accepted | 10 | 4224 | 234 | def gcd(a,b):
if b == 0:
return a
else:
return gcd(b ,a%b)
def lcm(a,b):
return a*b / gcd(a,b)
while True:
try:
a = map(int,raw_input().split())
a,b = a[0],a[1]
print gcd(a,b)
except EOFError:
break | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,356 |
s080189102 | p00595 | u104911888 | 1368082134 | Python | Python | py | Accepted | 30 | 5888 | 200 | import fractions
while True:
try:
a,b=map(int,raw_input().split())
except EOFError:
break
print fractions.gcd(a,b) | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,357 |
s677118443 | p00595 | u260980560 | 1385475928 | Python | Python | py | Accepted | 20 | 4196 | 174 | import sys
for s in sys.stdin.readlines():
m,n = map(int, s.split())
if n>m: n,m=m,n
while 1:
r = m%n
if r==0: break
m,n = n,r
print n | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,358 |
s811634772 | p00595 | u621997536 | 1388318709 | Python | Python | py | Accepted | 10 | 4192 | 167 |
while True:
try:
a, b = sorted(map(int, raw_input().split()))
while a:
tmp = a
a = b % a;
b = tmp
print b
except EOFError:
break | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,359 |
s045755253 | p00595 | u633068244 | 1394197971 | Python | Python | py | Accepted | 10 | 4196 | 207 | def gmd(x, y):
if y == 0:
return x
else:
return gmd(y, x%y)
while True:
try:
a, b = map(int, raw_input().split())
print gmd(a,b)
except:
break | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,360 |
s796396230 | p00595 | u350508326 | 1400413680 | Python | Python3 | py | Accepted | 40 | 6724 | 369 | def main():
while True:
try:
a, b = map(int, input().split())
print(euclid_algorithm(a, b))
except EOFError as e:
break
def euclid_algorithm(a, b):
while a and b:
if a > b:
a = a - b
else:
b = b - a
return a i... | p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,361 |
s631402543 | p00595 | u814278309 | 1592143496 | Python | Python3 | py | Accepted | 20 | 5652 | 124 | import math
while 1:
try:
a,b = map(int,input().split())
print(math.gcd(a,b))
except:
break
| p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,362 |
s131847257 | p00595 | u842461513 | 1588639661 | Python | Python3 | py | Accepted | 20 | 5656 | 132 | import math
try:
while True:
a,b = input().split(" ")
print(math.gcd(int(a),int(b)))
except EOFError:
m = 0
| p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,363 |
s471565037 | p00595 | u539753516 | 1532475840 | Python | Python3 | py | Accepted | 20 | 5656 | 95 | import math
while True:
try:print(math.gcd(*map(int,input().split(" "))))
except:break
| p00595 |
<H1><font color="#000000">Problem A:</font> Greatest Common Divisor</H1>
<p>
Please find the greatest common divisor of two natural numbers. A clue is: The Euclid's algorithm is a way to resolve this task.
</p>
<H2>Input</H2>
<p>
The input file consists of several lines with pairs of two natural numbers in each lin... | 57 38
60 84
| 19
12
| 23,364 |
s051056354 | p00596 | u943441430 | 1545273358 | Python | Python3 | py | Accepted | 70 | 5620 | 1,628 | import sys
def subset(line):
l = line.strip().split(" ")
a = list(map(int, l))
xy = list(map(lambda x: [x // 10, x % 10], a))
dominos = [[2 if [x, y] in xy and x == y else \
1 if [x, y] in xy else \
1 if [y, x] in xy else 0 \
for x in range(0, 7)] for y i... | p00596 |
<H1><font color="#000000">Problem B:</font> Dominoes Arrangement</H1>
<pre>
[0, 0]
[0, 1] [1, 1]
[0, 2] [1, 2] [2, 2]
[0, 3] [1, 3] [2, 3] [3, 3]
[0, 4] [1, 4] [2, 4] [3, 4] [4, 4]
[0, 5] [1, 5] [2, 5] [3, 5] [4, 5] [5, 5]
[0, 6] [1, 6] [2, 6] [3, 6] [4, 6] [5, 6] [6, 6]
</pre>
<p>
Consider the ... | 6
13 23 14 24 15 25
10
00 01 11 02 12 22 03 13 23 33
| Yes
No
| 23,365 |
s189305121 | p00596 | u844945939 | 1417916997 | Python | Python3 | py | Accepted | 30 | 6756 | 1,097 | class UnionFind():
def __init__(self, n):
self.parent = list(range(n))
self.rank = [0] * n
def find(self, x):
if self.parent[x] == x:
return x
else:
self.parent[x] = self.find(self.parent[x])
return self.parent[x]
def unite(self, x, y):
... | p00596 |
<H1><font color="#000000">Problem B:</font> Dominoes Arrangement</H1>
<pre>
[0, 0]
[0, 1] [1, 1]
[0, 2] [1, 2] [2, 2]
[0, 3] [1, 3] [2, 3] [3, 3]
[0, 4] [1, 4] [2, 4] [3, 4] [4, 4]
[0, 5] [1, 5] [2, 5] [3, 5] [4, 5] [5, 5]
[0, 6] [1, 6] [2, 6] [3, 6] [4, 6] [5, 6] [6, 6]
</pre>
<p>
Consider the ... | 6
13 23 14 24 15 25
10
00 01 11 02 12 22 03 13 23 33
| Yes
No
| 23,366 |
s183916687 | p00596 | u467175809 | 1533280969 | Python | Python | py | Accepted | 10 | 5036 | 838 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
import math
sys.setrecursionlimit(10000000)
while True:
try:
n = input()
except:
break
A = raw_input().split()
E = [[] for i in range(7)]
for s in A:
u = int(s[0])
v = int(s[1])
... | p00596 |
<H1><font color="#000000">Problem B:</font> Dominoes Arrangement</H1>
<pre>
[0, 0]
[0, 1] [1, 1]
[0, 2] [1, 2] [2, 2]
[0, 3] [1, 3] [2, 3] [3, 3]
[0, 4] [1, 4] [2, 4] [3, 4] [4, 4]
[0, 5] [1, 5] [2, 5] [3, 5] [4, 5] [5, 5]
[0, 6] [1, 6] [2, 6] [3, 6] [4, 6] [5, 6] [6, 6]
</pre>
<p>
Consider the ... | 6
13 23 14 24 15 25
10
00 01 11 02 12 22 03 13 23 33
| Yes
No
| 23,367 |
s013588565 | p00596 | u847467233 | 1530779122 | Python | Python3 | py | Accepted | 20 | 5596 | 489 | # AOJ 1010: Dominoes Arrangement
# Python3 2018.7.5 bal4u
while True:
try: n = int(input())
except: break
f, g = [0]*7, [0]*7
p = list(input().split())
for x in p:
if x[0] == x[1]: g[int(x[0])] = 1
else:
f[int(x[0])] += 1
f[int(x[1])] += 1
if n == 1:
print("Yes")
continue
ans = 1
for i in range(7... | p00596 |
<H1><font color="#000000">Problem B:</font> Dominoes Arrangement</H1>
<pre>
[0, 0]
[0, 1] [1, 1]
[0, 2] [1, 2] [2, 2]
[0, 3] [1, 3] [2, 3] [3, 3]
[0, 4] [1, 4] [2, 4] [3, 4] [4, 4]
[0, 5] [1, 5] [2, 5] [3, 5] [4, 5] [5, 5]
[0, 6] [1, 6] [2, 6] [3, 6] [4, 6] [5, 6] [6, 6]
</pre>
<p>
Consider the ... | 6
13 23 14 24 15 25
10
00 01 11 02 12 22 03 13 23 33
| Yes
No
| 23,368 |
s405496322 | p00597 | u266872031 | 1482961702 | Python | Python | py | Accepted | 10 | 6376 | 362 | while(1):
try:
n=int(raw_input())
if n==1:
print 1
else:
A=[0 for i in range(n/2)]
A[0]=1
for i in range(1,n/2):
A[i]=1+sum(A[:i])*2
ans=sum(A)*2
if n%2:
ans+=1+sum(A)*2
print ... | p00597 |
<H1><font color="#000000">Problem C:</font> Finding the Largest Carbon Compound Given Its Longest Chain</H1>
<p>
An bydrocarbon is an organic compound which contains only carbons and hydrogens. An isomer is a compound that has the same number of carbons but different structures. Heptane, for example, is a hydrocarbon... | 1
4
| 1
8
| 23,369 |
s770315505 | p00597 | u847467233 | 1530705621 | Python | Python3 | py | Accepted | 20 | 5592 | 217 | # AOJ 1011: Finding the Largest Carbon Compound Give...
# Python3 2018.7.4 bal4u
a = [0]*32
a[1], a[2] = 1, 2
for i in range(3, 31): a[i] = 3*a[i-2] + 2
while True:
try: i = int(input())
except: break
print(a[i])
| p00597 |
<H1><font color="#000000">Problem C:</font> Finding the Largest Carbon Compound Given Its Longest Chain</H1>
<p>
An bydrocarbon is an organic compound which contains only carbons and hydrogens. An isomer is a compound that has the same number of carbons but different structures. Heptane, for example, is a hydrocarbon... | 1
4
| 1
8
| 23,370 |
s889355551 | p00597 | u467175809 | 1533282097 | Python | Python | py | Accepted | 10 | 5016 | 367 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
import math
sys.setrecursionlimit(10000000)
for line in sys.stdin:
n = int(line)
ans = 1
for i in range(n / 2 - 1):
ans = ans * 3 + 1
if n == 1:
ans = 1
elif n % 2 == 1:
ans = ans * 4 + 1... | p00597 |
<H1><font color="#000000">Problem C:</font> Finding the Largest Carbon Compound Given Its Longest Chain</H1>
<p>
An bydrocarbon is an organic compound which contains only carbons and hydrogens. An isomer is a compound that has the same number of carbons but different structures. Heptane, for example, is a hydrocarbon... | 1
4
| 1
8
| 23,371 |
s912923047 | p00598 | u943441430 | 1545296184 | Python | Python3 | py | Accepted | 20 | 5632 | 2,387 | import sys
def rpn(str):
r = []
stack = []
for i in range(0, len(str)):
c = str[i]
if c in "idsu":
while len(stack) > 0:
if stack[-1] in "idsuc":
a = stack.pop()
r.extend(a)
else:
break
... | p00598 |
<H1><font color="#000000">Problem D:</font> Operations with Finite Sets</H1>
<p>
Let <i>A, B, C, D, E</i> be sets of integers and let <i>U</i> is a universal set that includes all sets under consideration. All elements in any set are different (no repetitions).
</p>
<p>
u - <b>union</b> of two sets, <i>AuB</i> = {<i... | A 3
1 3 -1
B 4
3 1 5 7
D 1
5
R 0
cAiBdD
C 3
1 2 3
A 4
2 10 8 3
B 3
2 4 8
R 0
(As(AiB))uC
| 7
1 2 3 10
| 23,372 |
s831279361 | p00598 | u467175809 | 1533348581 | Python | Python | py | Accepted | 10 | 5036 | 1,875 | #!/usr/bin/env python
from collections import deque
import itertools as it
import sys
import math
sys.setrecursionlimit(10000000)
while True:
A = set()
B = set()
C = set()
D = set()
E = set()
while True:
try:
name, _ = raw_input().split()
if name == 'R':
... | p00598 |
<H1><font color="#000000">Problem D:</font> Operations with Finite Sets</H1>
<p>
Let <i>A, B, C, D, E</i> be sets of integers and let <i>U</i> is a universal set that includes all sets under consideration. All elements in any set are different (no repetitions).
</p>
<p>
u - <b>union</b> of two sets, <i>AuB</i> = {<i... | A 3
1 3 -1
B 4
3 1 5 7
D 1
5
R 0
cAiBdD
C 3
1 2 3
A 4
2 10 8 3
B 3
2 4 8
R 0
(As(AiB))uC
| 7
1 2 3 10
| 23,373 |
s679271492 | p00600 | u847467233 | 1530781665 | Python | Python3 | py | Accepted | 30 | 5944 | 865 | # AOJ 1014: Computation of Minimum Length of Pipeline
# Python3 2018.7.5 bal4u
import sys
from sys import stdin
input = stdin.readline
import heapq
while True:
s, d = map(int, input().split())
if s == 0: break
visited = [0]*100
Q = []
to = [[] for i in range(100)]
for i in range(s):
visited[i] = 1
c = list(... | p00600 |
<H1><font color="#000000">Problem F:</font> Computation of Minimum Length of Pipeline</H1>
<p>
The Aizu Wakamatsu city office decided to lay a hot water pipeline covering the whole area of the city to heat houses. The pipeline starts from some hot springs and connects every district in the city. The pipeline can fork... | 3 5
12 8 25 19 23
9 13 16 0 17
20 14 16 10 22
17 27 18 16
9 7 0
19 5
21
0 0
| 38
| 23,374 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.