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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s748860344 | p00108 | u912237403 | 1414921089 | Python | Python | py | Accepted | 20 | 4200 | 175 | while input()!=0:
a=map(int,raw_input().split())
c=0
while 1:
b=[a.count(e) for e in a]
if a==b: break
else: a=b; c+=1
print c
print " ".join(map(str,a)) | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,769 |
s422294607 | p00108 | u912237403 | 1414921378 | Python | Python | py | Accepted | 20 | 4200 | 184 | while int(raw_input())!=0:
a=map(int,raw_input().split())
c=0
while 1:
b=[a.count(e) for e in a]
if a==b: break
else: a=b; c+=1
print c
print " ".join(map(str,a)) | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,770 |
s749973416 | p00108 | u912237403 | 1414921476 | Python | Python | py | Accepted | 20 | 4204 | 193 | while int(raw_input())!=0:
a = map(int, raw_input().split())
c = 0
while 1:
b = [a.count(e) for e in a]
if a==b: break
else: a=b; c+=1
print c
for e in a: print e,
print | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,771 |
s380948787 | p00108 | u912237403 | 1414921894 | Python | Python | py | Accepted | 20 | 4204 | 188 | def f(a,c):
b = [a.count(e) for e in a]
if a!=b: b,c=f(b,c+1)
return b, c
while input()!=0:
a = map(int,raw_input().split())
a, c = f(a,0)
print c
print " ".join(map(str,a)) | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,772 |
s119075619 | p00108 | u912237403 | 1414922026 | Python | Python | py | Accepted | 20 | 4208 | 196 | def f(a,c):
b = [a.count(e) for e in a]
if a!=b: b,c=f(b,c+1)
return b, c
while int(raw_input())!=0:
a = map(int,raw_input().split())
a,c = f(a,0)
print c
print " ".join(map(str,a)) | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,773 |
s640205683 | p00108 | u912237403 | 1414922088 | Python | Python | py | Accepted | 20 | 4204 | 206 | def f(a, c):
b = [a.count(e) for e in a]
if a!=b:
b, c=f(b, c+1)
return b, c
while int(raw_input())!=0:
a = map(int, raw_input().split())
a, c = f(a,0)
print c
print " ".join(map(str, a)) | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,774 |
s784030086 | p00108 | u266872031 | 1425220095 | Python | Python | py | Accepted | 20 | 4240 | 647 | def getnewline(line,N):
newline=[0 for x in range(N)]
dnum={}
for x in line:
if x in dnum:
dnum[x]=dnum[x]+1
else:
dnum[x]=1
for i in range(N):
newline[i]=dnum[line[i]]
return newline
while(1):
N=int(raw_input())
if N==0:
break
els... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,775 |
s211052595 | p00108 | u162387221 | 1431527975 | Python | Python | py | Accepted | 20 | 4232 | 360 | def count(n, ls, c = 0):
next_ls = [0]*n
for i in range(n):
next_ls[i] = ls.count(ls[i])
if ls == next_ls:
return c, ls
else:
return count(n, next_ls, c+1)
while True:
n = input()
if n == 0:
break
ls = map(int, raw_input().split())
a = count(n, ls)
prin... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,776 |
s353154699 | p00108 | u379499530 | 1432201003 | Python | Python | py | Accepted | 20 | 4232 | 344 | while True:
n = input()
if n == 0: break
s = [int(x) for x in raw_input().split()]
cnt = 0
while True:
c = [0] * n
for i in range(n):
c[i] = s.count(s[i])
if s == c: break
else:
s = c
cnt += 1
print cnt
print " ".j... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,777 |
s323531163 | p00108 | u873482706 | 1435226102 | Python | Python | py | Accepted | 20 | 4236 | 699 | def ocean(_S):
global S, count
count += 1
while _S:
a = _S[0]
n_S = []
c = 1
for v in _S[1:]:
if v == a:
c += 1
else:
n_S.append(v)
else:
dic[a] = str(c)
_S = n_S
else:
_S = []... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,778 |
s976798907 | p00108 | u489809100 | 1448031697 | Python | Python | py | Accepted | 20 | 6272 | 365 | while True:
n = input()
if n == 0:
break
array = map(int,raw_input().split())
aray = []
count = 0
while array != aray:
aray = array
agency = []
for i in xrange(n):
agency.append(array.count(array[i]))
array = agency
count += 1
print count - 1
string = ""
for var in array:
string += str(... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,779 |
s596956538 | p00108 | u892831253 | 1465319803 | Python | Python | py | Accepted | 20 | 6268 | 365 | while True:
n = input()
if n == 0:
break
array = map(int,raw_input().split())
aray = []
count = 0
while array != aray:
aray = array
agency = []
for i in xrange(n):
agency.append(array.count(array[i]))
array = agency
count += 1
print count - 1
string = ""
for var in array:
string += str(... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,780 |
s709712242 | p00108 | u589886885 | 1472275340 | Python | Python3 | py | Accepted | 40 | 7692 | 517 | while True:
n = int(input())
if n == 0:
break
a = [int(x) for x in input().split()]
cnt = 0
while True:
b = {}
for i in a:
if i in b:
b[i] += 1
else:
b[i] = 1
c = 0
for k, v in b.items():
if k... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,781 |
s205076605 | p00108 | u350804311 | 1473378366 | Python | Python3 | py | Accepted | 80 | 7552 | 354 | while True:
n = int(input())
if n == 0:
break
s = []
u = 0
v = 0
s = list(map(int, input().split()))
while True:
t = []
for i in range(n):
for j in range(n):
if s[i] == s[j]:
u += 1
t.append(u)
t_str = list(map(str, t))
u = 0
if s == t:
print(str(v))
print(" ".join(t_str))
... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,782 |
s013688740 | p00108 | u500396695 | 1478580152 | Python | Python3 | py | Accepted | 40 | 7608 | 261 | def FOA(a, count):
b = [a.count(a[i]) for i in range(len(a))]
if b == a:
print(count)
print(" ".join(map(str, b)))
return
else:
return FOA(b, count+1)
while True:
n = int(input())
if n == 0:
break
a = list(map(int, input().split()))
FOA(a, 0) | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,783 |
s170821224 | p00108 | u500396695 | 1478580239 | Python | Python3 | py | Accepted | 30 | 7668 | 252 | def FOA(a, count):
b = [a.count(a[i]) for i in range(len(a))]
if b == a:
print(count)
print(" ".join(map(str, b)))
else:
return FOA(b, count+1)
while True:
n = int(input())
if n == 0:
break
a = list(map(int, input().split()))
FOA(a, 0) | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,784 |
s619546124 | p00108 | u301729341 | 1482139650 | Python | Python3 | py | Accepted | 30 | 7576 | 468 | while True:
n = int(input())
if n == 0:
break
Num_lis = list(map(int,input().split()))
New_lis = []
num = 0
while True:
for i in range(n):
New_lis.append(Num_lis.count(Num_lis[i]))
if Num_lis == New_lis:
break
num += 1
Num_lis = New... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,785 |
s196045650 | p00108 | u078042885 | 1484648732 | Python | Python3 | py | Accepted | 30 | 7732 | 206 | def f(a,c):
b=[a.count(i) for i in a]
if b==a:print(c);print(' '.join(map(str,b)));return
f(b,c+1)
while 1:
n=int(input())
if not n:break
a=list(map(int,input().split()))
f(a,0) | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,786 |
s548408659 | p00108 | u546285759 | 1491561432 | Python | Python3 | py | Accepted | 30 | 7480 | 290 | while True:
n = int(input())
if n == 0:
break
S = list(map(int, input().split()))
cnt = 0
while S:
cur = [S.count(s) for s in S]
if cur == S:
break
cnt += 1
S = cur[::]
print(cnt)
print(' '.join(map(str, cur))) | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,787 |
s541593620 | p00108 | u462831976 | 1494244818 | Python | Python3 | py | Accepted | 30 | 7668 | 421 | # -*- coding: utf-8 -*-
import sys
import os
import math
def freq_op(A):
B = []
for a in A:
B.append(A.count(a))
return B
for s in sys.stdin:
n = int(s)
if n == 0:
break
A = list(map(int, input().split()))
cnt = 0
while True:
B = freq_op(A)
cnt += 1
... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,788 |
s412140049 | p00108 | u454206243 | 1494401414 | Python | Python3 | py | Accepted | 40 | 8068 | 506 | import sys
from collections import Counter
def c2f(data):
num = 0
while True:
counter = Counter(data)
next = [counter[item] for item in data]
if data == next:
break
num += 1
data = next
return num, data
while True:
num = int(sys.stdin.readline())
... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,789 |
s843640277 | p00108 | u957021183 | 1505295466 | Python | Python3 | py | Accepted | 40 | 7784 | 710 | # Aizu Problem 0108: Operation of Frequency of Appearance
#
import sys, math, os
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
def operation_of_frequency_of_appearance(S):
S_old = S[:]
steps = 0
while True:
unique = list(set(S))
... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,790 |
s027113074 | p00108 | u811733736 | 1506837865 | Python | Python3 | py | Accepted | 30 | 8036 | 733 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0108
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
while True:
# S = [4, 5, 1, 1, 4, 5, 12, 3, 5, 4]
n = int(input())
if n == 0:
break
S = [int(x) for x i... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,791 |
s758001979 | p00108 | u811733736 | 1506838236 | Python | Python3 | py | Accepted | 60 | 8068 | 773 | # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0108
AC
"""
import sys
from sys import stdin
input = stdin.readline
def main(args):
while True:
# S = [4, 5, 1, 1, 4, 5, 12, 3, 5, 4]
n = int(input())
if n == 0:
break
S = [int(x) for x... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,792 |
s053088341 | p00108 | u960312159 | 1508981981 | Python | Python3 | py | Accepted | 30 | 7564 | 323 | while True:
n = int(input())
if n == 0:
break
a = list(map(int, input().split()))
b = []
cnt = 0
while True:
for m in a:
b.append(a.count(m))
if a == b:
break
cnt += 1
a = b
b = []
print(cnt)
print(' '.join(map(str,b... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,793 |
s694891768 | p00108 | u742178809 | 1511770256 | Python | Python3 | py | Accepted | 30 | 7716 | 695 | import sys
#from me.io import dup_file_stdin
#@dup_file_stdin
def solve():
while True:
n = int(sys.stdin.readline())
if n == 0 : return
a = list(map(int,sys.stdin.readline().split(' ')))
ops = 0
while True:
cnt = dict()
for x in a:
cnt... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,794 |
s621042122 | p00108 | u742505495 | 1512641121 | Python | Python3 | py | Accepted | 30 | 5604 | 299 | while 1:
n=int(input())
if n==0:
break
s=list(map(int,input().split()))
cont=0
while 1:
tmp=[]
for i in range(n):
tmp.append(s.count(s[i]))
if s==tmp:
print(cont)
break
else:
s=tmp
cont+=1
for i in range(n):
if i != n-1:
print(s[i],end=' ')
else:
print(s[i]) | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,795 |
s443351022 | p00108 | u808429775 | 1516449027 | Python | Python3 | py | Accepted | 30 | 5612 | 765 | output = []
while True:
length = int(input())
if length == 0:
break
oldList = [int(item) for item in input().split(" ")]
operateCount = 0
while True:
numberCount = {}
for item in oldList:
if item in numberCount:
numberCount[item] += 1
... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,796 |
s197967630 | p00108 | u808429775 | 1516449189 | Python | Python3 | py | Accepted | 30 | 5604 | 710 | while True:
length = int(input())
if length == 0:
break
oldList = [int(item) for item in input().split(" ")]
operateCount = 0
while True:
numberCount = {}
for item in oldList:
if item in numberCount:
numberCount[item] += 1
else:
... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,797 |
s722703722 | p00108 | u150984829 | 1517521047 | Python | Python3 | py | Accepted | 30 | 5600 | 163 | while 1:
n=int(input())
if n==0:break
s=list(map(int,input().split()))
c=0
while 1:
t=s;s=[t.count(e)for e in t]
if t==s:break
c+=1
print(c);print(*s)
| p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,798 |
s379710417 | p00108 | u150984829 | 1517521050 | Python | Python3 | py | Accepted | 30 | 5604 | 163 | while 1:
n=int(input())
if n==0:break
s=list(map(int,input().split()))
c=0
while 1:
t=s;s=[t.count(e)for e in t]
if t==s:break
c+=1
print(c);print(*s)
| p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,799 |
s683281772 | p00108 | u150984829 | 1517521052 | Python | Python3 | py | Accepted | 30 | 5604 | 163 | while 1:
n=int(input())
if n==0:break
s=list(map(int,input().split()))
c=0
while 1:
t=s;s=[t.count(e)for e in t]
if t==s:break
c+=1
print(c);print(*s)
| p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,800 |
s951095783 | p00108 | u150984829 | 1517521062 | Python | Python3 | py | Accepted | 30 | 5608 | 163 | while 1:
n=int(input())
if n==0:break
s=list(map(int,input().split()))
c=0
while 1:
t=s;s=[t.count(e)for e in t]
if t==s:break
c+=1
print(c);print(*s)
| p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,801 |
s920894695 | p00108 | u150984829 | 1517521684 | Python | Python3 | py | Accepted | 30 | 5608 | 154 | while 1:
if'0'==input():break
s=list(map(int,input().split()))
c=0
while 1:
t=s;s=[t.count(e)for e in t]
if t==s:break
c+=1
print(c);print(*s)
| p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,802 |
s733784494 | p00108 | u150984829 | 1517560949 | Python | Python3 | py | Accepted | 30 | 5720 | 189 | import sys
a=sys.stdin
while 1:
if'0\n'==a.readline():break
s=list(map(int,a.readline().split()))
c=0
while 1:
t=s;s=[t.count(e)for e in t]
if t==s:break
c+=1
print(c);print(*s)
| p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,803 |
s281152016 | p00108 | u150984829 | 1517560952 | Python | Python3 | py | Accepted | 20 | 5720 | 189 | import sys
a=sys.stdin
while 1:
if'0\n'==a.readline():break
s=list(map(int,a.readline().split()))
c=0
while 1:
t=s;s=[t.count(e)for e in t]
if t==s:break
c+=1
print(c);print(*s)
| p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,804 |
s976670392 | p00108 | u043254318 | 1522252100 | Python | Python3 | py | Accepted | 40 | 5608 | 627 | def get_input():
while True:
try:
yield ''.join(input())
except EOFError:
break
while True:
N = int(input())
if N == 0:
break
p = [int(i) for i in input().split()]
cnt = 0
while True:
flag = True
s = [0 for i in range(101)]
... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,805 |
s726764930 | p00108 | u352394527 | 1527700636 | Python | Python3 | py | Accepted | 50 | 5992 | 414 | from collections import Counter
while True:
n = int(input())
if not n:
break
slst = list(map(int, input().split()))
temp = [i for i in slst]
ans = 0
while True:
ans += 1
counter = Counter()
for i in slst:
counter[i] += 1
slst = [counter[i] for i in temp]
if temp ... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,806 |
s484953773 | p00108 | u136916346 | 1528555394 | Python | Python3 | py | Accepted | 30 | 6000 | 328 | from collections import Counter
def pr(s):
c=0
while 1:
b=s
t=Counter(s)
s=[t[i] for i in s]
c+=1
if b==s:break
return s,c-1
while 1:
le=int(input())
if not le:break
s=list(map(int,input().split()))
s,c=pr(s)
print(c)
print(" ".join(map(s... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,807 |
s699150641 | p00108 | u847467233 | 1529274275 | Python | Python3 | py | Accepted | 30 | 5604 | 466 | # AOJ 0108 Operation of Frequency of Appearance
# Python3 2018.6.18 bal4u
f = [0]*105
a = [[0 for j in range(15)] for i in range(2)]
while True:
n = int(input())
if n == 0: break
a[0] = list(map(int, input().split()))
a[1] = [0]*n
cnt = k1 = 0
while True:
for i in range(n): f[a[k1][i]] += 1
k2 = 1-k1
for i... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,808 |
s637414805 | p00108 | u459861655 | 1353594311 | Python | Python | py | Accepted | 20 | 4252 | 600 | def answer(arr):
l, m = [], []
h = {}
for num in arr:
l.append(num)
i = 0
while True:
i += 1
h, m = {}, []
for num in l:
if h.has_key(num):
h[num] += 1
else:
h[num] = 1
for num in l:
m.appen... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,809 |
s997860688 | p00108 | u665962315 | 1357435946 | Python | Python | py | Accepted | 20 | 4236 | 392 | def OFA(seq):
return [seq.count(e) for e in seq]
def find_P(seq):
count = 0
prev = seq
while True:
new = OFA(prev)
count += 1
if new == prev:
return count - 1, prev
prev = new
while True:
n = int(raw_input())
if n == 0: break
c, P = find_P(map(i... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,810 |
s490490387 | p00108 | u647766105 | 1359018933 | Python | Python | py | Accepted | 20 | 4224 | 217 | while not input()==0:
pos=map(int,raw_input().split())
pre=[]
c=0
while not pre==pos:
pre=pos[:]
pos=[pre.count(n) for n in pre]
c+=1
print c-1
print " ".join(map(str,pos)) | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,811 |
s787480135 | p00108 | u577457452 | 1361687599 | Python | Python | py | Accepted | 20 | 4356 | 282 | import itertools
while 1:
n = int(raw_input())
if n == 0: break
ss = map(int, raw_input().split())
for i in itertools.count(0):
ps = [ss.count(s) for s in ss]
if ps == ss:
break
ss = ps
print i
print ' '.join(map(str, ps)) | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,812 |
s509944688 | p00108 | u104911888 | 1366607608 | Python | Python | py | Accepted | 20 | 4244 | 286 | while True:
n=input()
if n==0:
break
S=list(map(int,raw_input().split()))
cnt=0
post=[S.count(S[i]) for i in range(n)]
while S<>post:
S=post[:]
cnt+=1
post=[S.count(S[i]) for i in range(n)]
print cnt
print " ".join(map(str,post)) | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,813 |
s734666335 | p00108 | u542421762 | 1370669688 | Python | Python | py | Accepted | 30 | 4480 | 534 | import sys
import math
def solv(s):
i = 0
while True:
i += 1
c = frequency(s)
if c == s:
break
else:
s = c
return (i - 1, c)
def frequency(lis):
lis2 = map(lambda x: count(x, lis), lis)
return lis2
def count(n, lis):
return len(filter... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,814 |
s290352939 | p00108 | u782850731 | 1382609679 | Python | Python | py | Accepted | 20 | 4624 | 654 | #!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit
from itertools import count
from collections import Counter
def main(readline=stdin.readline):
counter = Counter()
while 1:
if not int(readline()):
exit()
ary = [int(digit) for digit... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,815 |
s186855500 | p00108 | u633068244 | 1394960497 | Python | Python | py | Accepted | 10 | 4216 | 331 | def foa(a,count):
b = a[:]
for i in range(len(b)):
b[i] = a.count(a[i])
if b == a:
print count
print " ".join(map(str, b))
return
else:
return foa(b,count+1)
while True:
n = int(raw_input())
if n == 0:
break
a = map(int, raw_input().split())
... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,816 |
s805269925 | p00108 | u770042163 | 1597370013 | Python | Python3 | py | Accepted | 30 | 5596 | 871 | # 辞書型のキーで数字を判別し、バリューにカウンタを用意
# 上記辞書を元に出現頻度操作関数を行う関数を作成し、都度呼び出す
# 出現頻度操作関数では不動点を求めるまでループさせ続ける
def transport(L,before_L=[],cnt=0):
cnt += 1
if L==before_L:
print(cnt-2)
return cnt
L_before = L[:]
dic = {}
for i in L:
dic[i] = 0
for i in L:
dic[i] += 1
# 上の2つのfo... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,817 |
s476892151 | p00108 | u260980560 | 1588639077 | Python | Python3 | py | Accepted | 40 | 5992 | 360 | from collections import Counter
def solve():
N = int(input())
if N == 0:
return False
*S, = map(int, input().split())
cnt = 0
while 1:
c = Counter(S)
*T, = map(c.__getitem__, S)
if S == T:
break
S = T
cnt += 1
print(cnt)
print(*S)
... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,818 |
s930587658 | p00108 | u630911389 | 1586941836 | Python | Python3 | py | Accepted | 30 | 5604 | 685 | def getFreequencyStr(arr):
datas = [0] * 101
arr2 = [0] * len(arr)
# 数を数える
for i in range(0,len(arr)):
datas[arr[i]] += 1
# 頻出を配列にする
for i in range(0,len(arr)):
arr2[i] = datas[arr[i]]
return arr2
while(1):
n = int(input())
changeNum = 0
if n == 0:
... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,819 |
s139476529 | p00108 | u314166831 | 1563996576 | Python | Python3 | py | Accepted | 40 | 5696 | 3,204 | # coding=utf-8
###
### for python 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 ptable... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,820 |
s979997367 | p00108 | u647694976 | 1561436768 | Python | Python3 | py | Accepted | 30 | 5596 | 421 | def operation(N,point):
N_another = []
for i in N:
count = 0
for j in N:
if i==j:
count +=1
N_another.append(count)
if N==N_another:return N,point
else:return operation(N_another,point+1)
while 1:
num=int(input())
if num==0:break
N=list(map... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,821 |
s915247821 | p00108 | u548252256 | 1561035241 | Python | Python3 | py | Accepted | 50 | 6336 | 451 | import copy
if __name__ == '__main__':
while True:
n = int(input())
if n == 0:
break
line = list(map(int,input().split()))
num = len(line)
ans = copy.deepcopy(line)
tmp = [0]*num
cnt = 0
for i,j in enumerate(ans):
tmp[i] = line.count(j)
while True:
if ans == tmp:
print(cnt)
pri... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,822 |
s577029305 | p00108 | u990228206 | 1551766053 | Python | Python3 | py | Accepted | 30 | 5592 | 350 | while 1:
n=int(input())
if n==0:break
count=0
S_keep=list(map(int,input().split()))
while 1:
S=[]
for i in S_keep:
S.append(S_keep.count(i))
if S_keep==S:
print(count)
print(" ".join(map(str,S)))
break
else:
... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,823 |
s092308086 | p00108 | u717526540 | 1543278698 | Python | Python3 | py | Accepted | 50 | 6332 | 421 | import copy
while 1:
n = int(input())
if n == 0:
break
datas = list(map(int, input().split()))
prev = copy.deepcopy(datas)
curr = [0] * n
cnt = 0
while 1:
for i, p in enumerate(prev):
curr[i] = prev.count(p)
if prev == curr:
break
p... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,824 |
s162472808 | p00108 | u024715419 | 1542263708 | Python | Python3 | py | Accepted | 40 | 5604 | 339 | while True:
n = int(input())
if n == 0:
break
s_list = [list(map(int, input().split()))]
i = 0
while True:
i += 1
s = []
for j in s_list[-1]:
s.append(s_list[-1].count(j))
if s == s_list[-1]:
break
s_list.append(s)
print(i -... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,825 |
s509823215 | p00108 | u525366883 | 1538277643 | Python | Python3 | py | Accepted | 30 | 5600 | 321 | while True:
n = int(input())
if n == 0:
break
a = list(map(int, input().split()))
b = []
cnt = 0
while True:
for i in a:
b.append(a.count(i))
if a == b:
break
else:
a, b = b[:], []
cnt+=1
print(cnt)
print(*a)... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,826 |
s751920002 | p00108 | u316584871 | 1538052949 | Python | Python3 | py | Accepted | 30 | 5596 | 597 | while True:
n = int(input()) ## n = len(S)
if (n==0):
break
S = list(map(int, input().split()))
C = []
for s in S:
num = S.count(s)
C.append(num)
c = 0
#print(c,C)
if (C == S):
print(c)
print(*C)
else:
while True:
copy = C[... | p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,827 |
s215814955 | p00108 | u319725914 | 1533973803 | Python | Python3 | py | Accepted | 30 | 5600 | 252 | while(int(input())):
ar = list(map(int, input().split()))
n = 0
while(True):
br = [ar.count(l) for l in ar]
if ar == br:
break
ar = br
n += 1
print(n)
print(" ".join(str(e) for e in br))
| p00108 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
</script>
<H1>出現頻度操作</H1>
<p>
有限数列の変換操作に出現頻度操作というものがありま... | 10
4 5 1 1 4 5 12 3 5 4
0
| 3
6 6 4 4 6 6 4 4 6 6
| 13,828 |
s722455688 | p00109 | u025180675 | 1545356869 | Python | Python3 | py | Accepted | 20 | 5664 | 1,206 | def digit():
global S
global cur
if S[cur].isdigit():
n = int(S[cur])
cur += 1
return n
def number():
global S
L = len(S)
global cur
n = digit()
while (cur < L and S[cur].isdigit()):
n = n*10 + digit()
return n
def expression():
global S
global... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,829 |
s580241083 | p00109 | u912237403 | 1414800306 | Python | Python | py | Accepted | 20 | 4356 | 860 | def f(s):
while 1:
b=s.find(")")
if b<0: return g(s)
a=s[:b].rfind("(")
s1=s[a:b+1]
s=s.replace(s1,f(s1[1:-1]))
def g(s):
a=""
f=1
x=[]
def F(a,b):
x.append(a)
x.append(b)
return 1,""
for c in s:
if c=="=": continue
elif c in "*/": f,a=F(a,c)
elif c in "+-":
... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,830 |
s472237403 | p00109 | u912237403 | 1414809180 | Python | Python | py | Accepted | 20 | 4336 | 748 | def f(s):
while 1:
b=s.find(")")
if b<0: return g(s)
a=s[:b].rfind("(")
s=s.replace(s[a:b+1],f(s[a+1:b]))
def g(s):
a=""
f=1
x=[]
def F(a,b):
x.append(a)
x.append(b)
return 1,""
for c in s:
if c=="=": continue
elif c in "*/": f,a=F(a,c)
elif c in "+-":
if f==1:... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,831 |
s554914861 | p00109 | u912237403 | 1414810744 | Python | Python | py | Accepted | 20 | 4320 | 695 | def f(s):
while 1:
b=s.find(")")
if b<0: return g(s)
a=s[:b].rfind("(")
s=s.replace(s[a:b+1],f(s[a+1:b]))
def g(s):
a=""
f=1
x=[]
def F(a,b):
x.append(a)
x.append(b)
return 1,""
for c in s:
if c=="=": continue
elif c in "*/": f,a=F(a,c)
elif c in "+-":
if f==1:... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,832 |
s674868114 | p00109 | u014849532 | 1420185760 | Python | Python3 | py | Accepted | 30 | 6740 | 593 | #!/usr/bin/python3
import re
class Num:
def __init__(this, x):
this.x = x
def __str__(this):
return str(this.x)
def __add__(this, that):
return Num(this.x + that.x)
def __sub__(this, that):
return Num(this.x - that.x)
def __truediv__(this, that):
return ... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,833 |
s713880707 | p00109 | u873482706 | 1435301199 | Python | Python | py | Accepted | 20 | 4384 | 2,060 | def up_to_you(formula):
l_p = None
r_p = None
for i, c in enumerate(formula):
if c == '(':
l_p = i
elif c == ')':
r_p = i
break
else:
print fx(formula)
return
r = fx(formula[l_p+1:r_p])
n_formula = formula[:l_p]+r+formula[r... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,834 |
s861048070 | p00109 | u220324665 | 1474020360 | Python | Python3 | py | Accepted | 30 | 7840 | 419 | import re
class c:
def __str__(self):
return str(self.x)
def __init__(self,value):
self.x=value
def __add__(self,value):
return c(self.x+value.x)
def __sub__(self,value):
return c(self.x-value.x)
def __mul__(self,value):
return c(self.x*value.x)
def __truediv__(self,value):
return c(int(self.x/value.x... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,835 |
s911414518 | p00109 | u078042885 | 1484742554 | Python | Python3 | py | Accepted | 30 | 7884 | 361 | import re
class c(int):
def __add__(self,n):
return c(int(self)+int(n))
def __sub__(self,n):
return c(int(self)-int(n))
def __mul__(self,n):
return c(int(self)*int(n))
def __truediv__(self,n):
return c(int(int(self)/int(n)))
for _ in range(int(input())):
print(eval... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,836 |
s011042776 | p00109 | u462831976 | 1494301228 | Python | Python3 | py | Accepted | 30 | 7984 | 737 | # -*- coding: utf-8 -*-
import sys
import os
import math
import re
class Num:
def __str__(self):
return str(self.x)
def __init__(self, value):
self.x = value
def __add__(self,value):
return Num(self.x + value.x)
def __sub__(self, value):
return Num(self.x - value.x)
... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,837 |
s649653277 | p00109 | u146816547 | 1504713385 | Python | Python | py | Accepted | 10 | 6368 | 1,553 | def String2List(s):
L = []
flag = True
l = len(s)
for i in range(l):
if s[i].isdigit() and flag:
t = ""
j = 0
while s[i+j].isdigit():
t += s[i+j]
if i+j == l-1:
break
j += 1
L.appe... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,838 |
s178581054 | p00109 | u146816547 | 1504789344 | Python | Python | py | Accepted | 20 | 6372 | 1,565 | def String2List(s):
L = []
flag = True
l = len(s)
for i in range(l):
if s[i].isdigit() and flag:
t = ""
j = 0
while s[i+j].isdigit():
t += s[i+j]
if i+j == l-1:
break
j += 1
L.appe... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,839 |
s927113497 | p00109 | u146816547 | 1504804038 | Python | Python | py | Accepted | 10 | 6360 | 1,564 | def String2List(s):
L = []
flag = True
l = len(s)
for i in range(l):
if s[i].isdigit() and flag:
t = ""
j = 0
while s[i+j].isdigit():
t += s[i+j]
if i+j == l-1:
break
j += 1
L.appe... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,840 |
s757593631 | p00109 | u960312159 | 1509430631 | Python | Python3 | py | Accepted | 30 | 7880 | 581 | import re
class Num:
def __init__(self, x):
self.x = x
def __str__(self):
return str(self.x)
def __add__(self, other):
return Num(self.x + other.x)
def __sub__(self, other):
return Num(self.x - other.x)
def __truediv__(self, other):
return Num(int(self.x ... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,841 |
s107157585 | p00109 | u146816547 | 1512268693 | Python | Python | py | Accepted | 10 | 4764 | 1,451 | # coding: utf-8
# Convert String to List
def String2List(s):
L = []; tmp = ""
for i in s:
if i.isdigit():
tmp += i
else:
if tmp != "":
L.append(tmp)
tmp = ""
L.append(i)
if tmp != "":
L.append(tmp)
return L
# ... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,842 |
s994852280 | p00109 | u742178809 | 1512524917 | Python | Python3 | py | Accepted | 20 | 5620 | 1,618 | import sys
#from me.io import dup_file_stdin
def prec(op):
if op in "+-":return 1
if op in "*/":return 2
raise NotImplementedError()
def postFix(expr):
stack = []
operators = []
num = 0
isdigit = False
for ch in expr:
if ch.isdigit():
isdigit = True
... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,843 |
s338953709 | p00109 | u808429775 | 1516967137 | Python | Python3 | py | Accepted | 20 | 5600 | 1,638 | def ReversePolishNotation(string):
priority = {"(": 0, ")": 0, "+": 1, "-": 1, "*": 2, "/": 2}
stack = []
signStack = []
isContinue = False
for item in string[:-1]:
if str.isdigit(item):
if not isContinue:
stack.append(item)
isContinue = True
... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,844 |
s969444263 | p00109 | u150984829 | 1517676247 | Python | Python3 | py | Accepted | 40 | 6604 | 302 | import re
class c(int):
def __add__(self,n):return c(int(self)+int(n))
def __sub__(self,n):return c(int(self)-int(n))
def __mul__(self,n):return c(int(self)*int(n))
def __truediv__(self,n):return c(int(int(self)/int(n)))
for _ in[0]*int(input()):print(eval(re.sub(r'(\d+)',r'c(\1)',input()[:-1])))
| p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,845 |
s507763584 | p00109 | u150984829 | 1517676251 | Python | Python3 | py | Accepted | 40 | 6608 | 302 | import re
class c(int):
def __add__(self,n):return c(int(self)+int(n))
def __sub__(self,n):return c(int(self)-int(n))
def __mul__(self,n):return c(int(self)*int(n))
def __truediv__(self,n):return c(int(int(self)/int(n)))
for _ in[0]*int(input()):print(eval(re.sub(r'(\d+)',r'c(\1)',input()[:-1])))
| p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,846 |
s168891567 | p00109 | u150984829 | 1517676256 | Python | Python3 | py | Accepted | 40 | 6604 | 302 | import re
class c(int):
def __add__(self,n):return c(int(self)+int(n))
def __sub__(self,n):return c(int(self)-int(n))
def __mul__(self,n):return c(int(self)*int(n))
def __truediv__(self,n):return c(int(int(self)/int(n)))
for _ in[0]*int(input()):print(eval(re.sub(r'(\d+)',r'c(\1)',input()[:-1])))
| p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,847 |
s576079954 | p00109 | u150984829 | 1517676530 | Python | Python3 | py | Accepted | 40 | 6612 | 382 | import re
class c:
def __init__(self,value):self.x=value
def __str__(self):return str(self.x)
def __add__(self,value):return c(self.x+value.x)
def __sub__(self,value):return c(self.x-value.x)
def __mul__(self,value):return c(self.x*value.x)
def __truediv__(self,value):return c(int(self.x/value.x))
for i in[0]*int... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,848 |
s255199840 | p00109 | u150984829 | 1517757933 | Python | Python3 | py | Accepted | 20 | 5604 | 462 | r={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
L=[];t=''
for e in input()[:-1]:
if e.isdigit():t+=e
else:
if t:L+=[t];t=''
L+=e
if t:L+=[t]
P,S=[],[]
for i in L:
if"("==i:S+=i
elif")"==i:
while"("!=S[-1]:P+=S.pop()
S.pop()
elif i in r:
while S and r[S[-1]]>=r[i]:P+=S.pop... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,849 |
s866047446 | p00109 | u150984829 | 1518283805 | Python | Python3 | py | Accepted | 20 | 5608 | 451 | R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
L=[];t=''
for e in input()[:-1]:
if e.isdigit():t+=e
else:
if t:L+=[t];t=''
L+=e
if t:L+=[t]
P,S=[],[]
for i in L:
if"("==i:S+=i
elif")"==i:
while"("!=S[-1]:P+=S.pop()
S.pop()
elif i in R:
while S and R[S[-1]]>=R[i]:P+=S.pop... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,850 |
s122206180 | p00109 | u150984829 | 1518283908 | Python | Python3 | py | Accepted | 30 | 5612 | 448 | R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
L=[];t=''
for e in input()[:-1]:
if e.isdigit():t+=e
else:
if t:L+=[t];t=''
L+=e
if t:L+=[t]
P,S=[],[]
for i in L:
if"("==i:S+=i
elif")"==i:
while"("!=S[-1]:P+=S.pop()
S.pop()
elif i in R:
while S and R[S[-1]]>=R[i]:P+=S.pop... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,851 |
s112579348 | p00109 | u150984829 | 1518283911 | Python | Python3 | py | Accepted | 30 | 5604 | 448 | R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
L=[];t=''
for e in input()[:-1]:
if e.isdigit():t+=e
else:
if t:L+=[t];t=''
L+=e
if t:L+=[t]
P,S=[],[]
for i in L:
if"("==i:S+=i
elif")"==i:
while"("!=S[-1]:P+=S.pop()
S.pop()
elif i in R:
while S and R[S[-1]]>=R[i]:P+=S.pop... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,852 |
s356582830 | p00109 | u150984829 | 1518283913 | Python | Python3 | py | Accepted | 30 | 5604 | 448 | R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
L=[];t=''
for e in input()[:-1]:
if e.isdigit():t+=e
else:
if t:L+=[t];t=''
L+=e
if t:L+=[t]
P,S=[],[]
for i in L:
if"("==i:S+=i
elif")"==i:
while"("!=S[-1]:P+=S.pop()
S.pop()
elif i in R:
while S and R[S[-1]]>=R[i]:P+=S.pop... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,853 |
s580323602 | p00109 | u150984829 | 1518283914 | Python | Python3 | py | Accepted | 30 | 5608 | 448 | R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
L=[];t=''
for e in input()[:-1]:
if e.isdigit():t+=e
else:
if t:L+=[t];t=''
L+=e
if t:L+=[t]
P,S=[],[]
for i in L:
if"("==i:S+=i
elif")"==i:
while"("!=S[-1]:P+=S.pop()
S.pop()
elif i in R:
while S and R[S[-1]]>=R[i]:P+=S.pop... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,854 |
s940405256 | p00109 | u150984829 | 1518283934 | Python | Python3 | py | Accepted | 30 | 5608 | 448 | R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
L=[];t=''
for e in input()[:-1]:
if e.isdigit():t+=e
else:
if t:L+=[t];t=''
L+=e
if t:L+=[t]
P,S=[],[]
for i in L:
if"("==i:S+=i
elif")"==i:
while"("!=S[-1]:P+=S.pop()
S.pop()
elif i in R:
while S and R[S[-1]]>=R[i]:P+=S.pop... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,855 |
s432758750 | p00109 | u150984829 | 1518283941 | Python | Python3 | py | Accepted | 30 | 5608 | 448 | R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
L=[];t=''
for e in input()[:-1]:
if e.isdigit():t+=e
else:
if t:L+=[t];t=''
L+=e
if t:L+=[t]
P,S=[],[]
for i in L:
if"("==i:S+=i
elif")"==i:
while"("!=S[-1]:P+=S.pop()
S.pop()
elif i in R:
while S and R[S[-1]]>=R[i]:P+=S.pop... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,856 |
s751064030 | p00109 | u150984829 | 1518283950 | Python | Python3 | py | Accepted | 30 | 5604 | 451 | R={"*":2,"/":2,"+":1,"-":1,"(":0,")":0}
for _ in[0]*int(input()):
L=[];t=''
for e in input()[:-1]:
if e.isdigit():t+=e
else:
if t:L+=[t];t=''
L+=e
if t:L+=[t]
P,S=[],[]
for i in L:
if"("==i:S+=i
elif")"==i:
while"("!=S[-1]:P+=S.pop()
S.pop()
elif i in R:
while S and R[S[-1]]>=R[i]:P+=S.pop... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,857 |
s040050709 | p00109 | u043254318 | 1523069104 | Python | Python3 | py | Accepted | 30 | 5616 | 1,669 | def get_input():
while True:
try:
yield ''.join(input())
except EOFError:
break
# Convert String to List
def String2List(s):
L = []; tmp = ""
for i in s:
if i.isdigit():
tmp += i
else:
if tmp != "":
L.append(tmp... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,858 |
s121670256 | p00109 | u136916346 | 1528609351 | Python | Python3 | py | Accepted | 40 | 6608 | 489 | import re
class o:
def __str__(self):
return str(self.x)
def __init__(self,value):
self.x=value
def __add__(self,value):
return o(self.x+value.x)
def __sub__(self,value):
return o(self.x-value.x)
def __mul__(self,value):
return o(self.x*value.x)
def __true... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,859 |
s244084259 | p00109 | u847467233 | 1529296278 | Python | Python3 | py | Accepted | 30 | 5628 | 1,595 | # AOJ 0109 Smart Calculator
# Python3 2018.6.18 bal4u
INF = 1000000010
LEFT = INF+1
RIGHT = INF+2
PLUS = INF+3
MINUS = INF+4
MUL = INF+5
DIV = INF+6
token = { '+':PLUS, '-':MINUS, '*':MUL, '/':DIV }
rank = { PLUS:2, MINUS:2, MUL:3, DIV:3, LEFT:1, RIGHT:1 }
S, top = [0]*200, 0
Q, end = [0]*200, 0
def getInt():
... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,860 |
s244694570 | p00109 | u855199458 | 1530508346 | Python | Python3 | py | Accepted | 40 | 6620 | 562 | # -*- coding: utf-8 -*-
# 写経した
import re
class Num:
def __str__(self):
return str(self.x)
def __init__(self, value):
self.x = value
def __add__(self, value):
return Num(self.x + value.x)
def __sub__(self, value):
return Num(self.x - value.x)
def __mul__(self, value):
... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,861 |
s265451778 | p00109 | u759949288 | 1354004891 | Python | Python | py | Accepted | 10 | 4272 | 859 | pos = 0
def number(s):
global pos
x = pos
if s[pos] == '-' or s[pos] == '+':
pos += 1
while s[pos].isdigit():
pos += 1
return int(s[x:pos])
expression = None
def factor(s):
global pos
if s[pos] == '(':
pos += 1
result = expression(s)
pos += 1
return result
else:
return number(s)
def term(s):
glob... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,862 |
s894892066 | p00109 | u147801965 | 1380809372 | Python | Python | py | Accepted | 10 | 4292 | 894 | abs2 = lambda a,b: -(abs(int(1.0*a/b)))
def number(begin):
global i
if begin[i] == "(":
i += 1
res = expression(begin)
i += 1
return res
res = 0
while begin[i].isdigit():
res *= 10
res += int(begin[i])
i+=1
return res
def term(begin):# your code goes here
global i
res = number(begin)
... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,863 |
s069393053 | p00109 | u611853667 | 1381953216 | Python | Python | py | Accepted | 20 | 4384 | 1,555 | def divide(x, y):
s = 1
if(x < 0):s *= -1
if(y < 0):s *= -1
return abs(x) / abs(y) * s
operator = {"+":(lambda x,y: x+y),
"-":(lambda x,y: x-y),
"*":(lambda x,y: x*y),
"/":divide
}
def ind(src, x):
if x not in src:return 1<<30
return src.ind... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,864 |
s712607780 | p00109 | u611853667 | 1381953394 | Python | Python | py | Accepted | 10 | 4368 | 1,350 | def divide(x, y):
s = 1
if(x < 0):s *= -1
if(y < 0):s *= -1
return abs(x) / abs(y) * s
operator = {"+":(lambda x,y: x+y),
"-":(lambda x,y: x-y),
"*":(lambda x,y: x*y),
"/":divide
}
def ind(src, x):
if x not in src:return 1<<30
return src.ind... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,865 |
s500728205 | p00109 | u782850731 | 1382804540 | Python | Python | py | Accepted | 20 | 4492 | 2,461 | #!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin, exit
from operator import add, sub, mul, truediv
def div(a, b):
return int(truediv(a, b))
class Parser(list):
"""
<statement> ::= <expression> "="
<expression> ::= <term> [ ("+"|"-") <term> ]
<term> ::= ... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,866 |
s622044773 | p00109 | u260980560 | 1400179683 | Python | Python | py | Accepted | 20 | 4292 | 963 | s = ""; l = 0;
def expr(idx):
ret, idx = term(idx)
while idx<l:
if s[idx]=='+':
r, idx = term(idx+1)
ret += r
elif s[idx]=='-':
r, idx = term(idx+1)
ret -= r
else:
break
return ret, idx
def term(idx):
ret, idx = fac... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,867 |
s320306046 | p00109 | u240091169 | 1594251465 | Python | Python3 | py | Accepted | 20 | 5668 | 2,249 | import math
def calc_zyouzyo(siki) :
j = 0
while True :
if '*' not in siki and '/' not in siki:
break
if siki[j] == '*' :
siki[j-1] = str(int(siki[j-1]) * int(siki[j+1]))
del siki[j:j+2]
elif siki[j] == '/' :
if (int(siki[j-1]) < 0 and int(... | p00109 |
<H1>Smart Calculator</H1>
<p>
Your task is to write a program which reads an expression and evaluates it.
</p>
<ul>
<li>The expression consists of numerical values, operators and parentheses, and the ends with '='.</li>
<li>The operators includes +, - , *, / where respectively represents, addition, subtraction, mul... | 2
4-2*3=
4*(8+4+3)=
| -2
60
| 13,868 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.