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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s739863436 | p02247 | u240839092 | 1582736977 | Python | Python3 | py | Accepted | 20 | 5572 | 166 | T, P = input(), input()
t, p = len(T), len(P)
if t>=p:
ans = [str(n) for n, i in enumerate(range(p, t+1)) if T[n:i]==P]
if ans:
print("\n".join(ans))
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,382 |
s562065122 | p02247 | u853741520 | 1578625868 | Python | Python3 | py | Accepted | 20 | 5568 | 102 | t = input()
p = input()
for i in range(len(t)-len(p)+1):
if t[i:i+len(p)] == p:
print(i)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,383 |
s837805680 | p02247 | u529459816 | 1577710317 | Python | Python3 | py | Accepted | 20 | 5572 | 467 | def search(t, p):
tn = len(t)
i = 0
pn = len(p)
plist = []
if pn <= tn:
while i < tn:
j = 0
while j < pn and i+j < tn:
if t[i+j] != p[j]: break
j += 1
if j == pn:
plist.append(i)
i += 1
return... | p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,384 |
s039920667 | p02247 | u123563150 | 1577005310 | Python | Python3 | py | Accepted | 20 | 5572 | 87 | t=input()
p=input()
for i in range(len(t)-len(p)+1):
if t[i:i+len(p)]==p:
print(i)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,385 |
s354780112 | p02247 | u798961710 | 1576657805 | Python | Python3 | py | Accepted | 20 | 5572 | 120 | line = input()
seq = input()
for i in range(len(line)-len(seq)+1):
if line[i:i+len(seq)] == seq:
print(i)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,386 |
s585047540 | p02247 | u942532706 | 1576245988 | Python | Python3 | py | Accepted | 20 | 5576 | 185 | # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_14_A&lang=ja
T = input()
P = input()
for j in range(len(T) - len(P) + 1):
if T[j:j+len(P)] == P:
print(j)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,387 |
s657574977 | p02247 | u476418873 | 1570337260 | Python | Python3 | py | Accepted | 20 | 5564 | 114 | parent = input()
key = input()
for i in range(len(parent)):
if parent[i:i+len(key)] == key:
print(i)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,388 |
s214214324 | p02247 | u803862921 | 1569654496 | Python | Python3 | py | Accepted | 20 | 5572 | 109 | T = input()
P = input()
t = len(T)
p = len(P)
for i in range(t-p+1):
if P == T[i:i+p]:
print(i)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,389 |
s226531220 | p02247 | u183700122 | 1568039997 | Python | Python3 | py | Accepted | 20 | 5572 | 103 | T = input()
S = input()
s = len(S)
for i in range(len(T)-s+1):
if T[i:i+s] == S:
print(i)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,390 |
s055916534 | p02247 | u784856415 | 1566543767 | Python | Python3 | py | Accepted | 30 | 5972 | 524 | #import pysnooper
#import os,re,sys,operator,math,heapq,string
from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy
setrecursionlimit(10**6)
input=std... | p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,391 |
s625234022 | p02247 | u182175955 | 1566456240 | Python | Python3 | py | Accepted | 20 | 5572 | 164 | t=input()
p=input()
l=len(t)-len(p)
ans=[]
for i in range(l+1):
if t[i:i+len(p)]==p:
ans.append(i)
#if ans==[]:
# sys.exit
for _ in ans:
print(_)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,392 |
s410408937 | p02247 | u817810878 | 1565695267 | Python | Python3 | py | Accepted | 60 | 7124 | 384 | import sys
from typing import List
if __name__ == "__main__":
input_str = input()
target_str = input()
target_str_len = len(target_str)
for idx, s in enumerate(input_str):
if len(input_str[idx:]) < target_str_len:
break
if s == target_str[0]:
if input_str[idx:i... | p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,393 |
s228173707 | p02247 | u212392281 | 1564877341 | Python | Python3 | py | Accepted | 20 | 5576 | 116 | l = input()
m = input()
n = len(l)
k = len(m)
c = 0
for i in range(n-k+1):
if l[i:i+k] == m:
print(i)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,394 |
s571510180 | p02247 | u088630381 | 1564108567 | Python | Python3 | py | Accepted | 20 | 5576 | 176 | T = input()
P = input()
n, result = 0, []
while n < len(T):
next_n = T.find(P, n)
if next_n < 0:
break
result.append(next_n)
n = next_n + 1
for r in result:
print(r)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,395 |
s575339441 | p02247 | u495152850 | 1561729107 | Python | Python3 | py | Accepted | 20 | 5572 | 301 | t = input()
p = input()
anslist = []
for i in range(len(t) - len(p) + 1):
if t[i] == p[0]:
k = 0
for j in range(i, i + len(p)):
if t[j] != p[k]:
break
k += 1
else:
anslist.append(i)
for ans in anslist:
print(ans)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,396 |
s494636888 | p02247 | u902579831 | 1561138945 | Python | Python3 | py | Accepted | 20 | 5560 | 95 | T = input()
P = input()
for i in range(len(T)):
if T[i:].startswith(P):
print(i)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,397 |
s167372923 | p02247 | u500948606 | 1561025575 | Python | Python3 | py | Accepted | 20 | 5572 | 133 | t = input()
p = input()
index = -1
while True:
index = t.find(p, index + 1)
if index == -1:
break
print(index)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,398 |
s047553492 | p02247 | u805716376 | 1556973734 | Python | Python3 | py | Accepted | 20 | 5564 | 101 | a = input()
b = input()
for i in range(len(a)):
if a[i:i+len(b)] == b:
print(i)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,399 |
s068724618 | p02247 | u203222829 | 1543651604 | Python | Python3 | py | Accepted | 20 | 5576 | 323 | # https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/14/ALDS1_14_A
def solve():
T = input()
P = input()
if len(T) < len(P):
exit()
for index, pos in enumerate(range(len(T) - len(P) + 1)):
if T[pos:pos+len(P)] == P:
print(index)
if __name__ == '__main__':
solve(... | p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,400 |
s056096806 | p02247 | u978863922 | 1543208143 | Python | Python3 | py | Accepted | 20 | 5584 | 925 | # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_14_A&lang=jp
# Naive String Search : python3
# 2018.11.26 yonezawa
import sys
input = sys.stdin.readline
#import cProfile
def main():
s1 = str(input()).rstrip('\n')
s2 = str(input()).rstrip('\n')
s1_len = len(s1)
s2_len = len(s2... | p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,401 |
s766160410 | p02247 | u717526540 | 1542872090 | Python | Python3 | py | Accepted | 20 | 5572 | 300 | t = input()
p = input()
anslist = []
for i in range(len(t) - len(p) + 1):
if t[i] == p[0]:
k = 0
for j in range(i, i + len(p)):
if t[j] != p[k]:
break
k += 1
else:
anslist.append(i)
for ans in anslist:
print(ans)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,402 |
s162908075 | p02247 | u125481461 | 1542491826 | Python | Python3 | py | Accepted | 20 | 5572 | 244 | def main():
text = input()
len_text = len(text)
pattern = input()
len_pattern = len(pattern)
for i in range(len_text - len_pattern + 1):
if text[i:i+len_pattern] == pattern:
print(i)
return
main()
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,403 |
s962072436 | p02247 | u665238221 | 1536124891 | Python | Python3 | py | Accepted | 30 | 5572 | 111 | T = input()
P = input()
lp = len(P)
for i in range(len(T) - lp + 1):
if T[i:i + lp] == P:
print(i)
| p02247 |
<H1>Naive String Search</H1>
<p>
Find places where a string <var>P</var> is found within a text <var>T</var>.
Print all indices of <var>T</var> where <var>P</var> found. The indices of <var>T</var> start with 0.
</p>
<H2>Input</H2>
<p>
In the first line, a text <var>T</var> is given. In the second line, a ... | aabaaa
aa
| 0
3
4
| 30,404 |
s216099189 | p02251 | u352394527 | 1545432461 | Python | Python3 | py | Accepted | 30 | 5592 | 86 | n = int(input())
ans = 0
for x in (25, 10, 5, 1):
ans += n // x
n %= x
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,405 |
s287985382 | p02251 | u799595944 | 1556402604 | Python | Python3 | py | Accepted | 30 | 5588 | 127 | n = int(input())
a1 = n//25
a2 = (n - a1*25)//10
a3 = (n - a1*25 - a2*10)//5
a4 = n - a1*25 - a2*10 - a3*5
print(a1+a2+a3+a4)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,406 |
s111393145 | p02251 | u189528630 | 1597559515 | Python | Python3 | py | Accepted | 20 | 5588 | 145 | n = input()
n_25 = int(n) // 25
tmp = int(n) % 25
n_10 = tmp // 10
tmp %= 10
n_5 = tmp // 5
tmp %= 5
n_1 = tmp
print(n_25 + n_10 + n_5 + n_1)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,407 |
s758975205 | p02251 | u880802684 | 1597382298 | Python | Python3 | py | Accepted | 20 | 5592 | 190 | # https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/15/ALDS1_15_A
n = int(input())
cnt = 0
coin = (25, 10, 5, 1)
for c in coin:
cnt += n // c
n -= c * (n // c)
print(cnt)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,408 |
s521297289 | p02251 | u747915832 | 1596992892 | Python | Python3 | py | Accepted | 20 | 5588 | 89 | n = int(input())
c = 0
c += n//25
n %= 25
c += n//10
n %= 10
c += n//5
c += n%5
print(c)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,409 |
s262072235 | p02251 | u525366883 | 1595394052 | Python | Python3 | py | Accepted | 20 | 5588 | 113 | n = int(input())
cnt = 0
cnt += n//25
n = n % 25
cnt += n//10
n = n % 10
cnt += n//5
n = n % 5
cnt+=n
print(cnt)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,410 |
s850684265 | p02251 | u450519077 | 1595072283 | Python | Python3 | py | Accepted | 20 | 5592 | 86 | n = int(input())
ans = 0
for x in (25, 10, 5, 1):
ans += n // x
n %= x
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,411 |
s595844032 | p02251 | u286677087 | 1594483372 | Python | Python3 | py | Accepted | 20 | 5592 | 119 | n = int(input())
coins = [25, 10, 5, 1]
ans = 0
for coin in coins:
ans += int(n/coin)
n = n%coin
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,412 |
s680760591 | p02251 | u759561356 | 1594012986 | Python | Python3 | py | Accepted | 20 | 5588 | 145 | n = input()
n_25 = int(n) // 25
tmp = int(n) % 25
n_10 = tmp // 10
tmp %= 10
n_5 = tmp // 5
tmp %= 5
n_1 = tmp
print(n_25 + n_10 + n_5 + n_1)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,413 |
s638756989 | p02251 | u973203074 | 1593352808 | Python | Python3 | py | Accepted | 20 | 5592 | 103 | n = int(input())
cnt = 0
for m in reversed([1, 5, 10, 25]):
cnt += n // m
n %= m
print(cnt)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,414 |
s134229697 | p02251 | u658049730 | 1592575936 | Python | Python3 | py | Accepted | 20 | 5596 | 168 | def main():
n = int(input())
cnt = 0
for i in [25, 10, 5, 1]:
cnt += n // i
n = n % i
print(cnt)
if __name__ == '__main__':
main()
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,415 |
s806027178 | p02251 | u239637240 | 1592485482 | Python | Python3 | py | Accepted | 20 | 5592 | 143 | n = int(input())
cnt = n // 25
n = n % 25
while n >= 10:
cnt += 1
n -= 10
while n >= 5:
cnt += 1
n -= 5
cnt += n
print(cnt)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,416 |
s013736049 | p02251 | u814278309 | 1592223881 | Python | Python3 | py | Accepted | 20 | 5596 | 121 | n = int(input())
coin = [25,10,5,1]
sum_s = 0
for i in coin:
sent = n // i
n %= i
sum_s += sent
print(sum_s)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,417 |
s254730398 | p02251 | u512884261 | 1592135337 | Python | Python3 | py | Accepted | 30 | 6000 | 556 | import sys, collections
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return ... | p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,418 |
s331699366 | p02251 | u842461513 | 1590795927 | Python | Python3 | py | Accepted | 20 | 5588 | 438 | #標準入力と変数の初期化
num = int(input())
coin = 0
#25セントを使える枚数を調べ合計金額から減らす
coin += num // 25
num -= num // 25 * 25
#10セントを使える枚数を調べ合計金額を減らす
coin += num // 10
num -= num // 10 * 10
#5セントを使える枚数を調べ合計金額を減らす
coin += num // 5
num -= num // 5 * 5
#1セントの枚数を足し出力する
print(coin + num)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,419 |
s406889007 | p02251 | u704109794 | 1589733156 | Python | Python3 | py | Accepted | 20 | 5592 | 290 | m = int(input()) #money
c =0 #count coin
tc = 0 #temp coin
if m>=25:
c = m//25
m = m-(25*c)
if m>=10:
tc = m//10
m = m-(10*tc)
c += tc
if m>=5:
tc = m//5
m = m-(5*tc)
c += tc
if m>=0:
tc = m//1
m = m-(1*tc)
c += tc
print(c)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,420 |
s566953859 | p02251 | u815830103 | 1589452320 | Python | Python3 | py | Accepted | 20 | 5600 | 188 | def main():
n = int(input())
C = [25,10,5,1]
ans = 0
for i in range(4):
ans += n // C[i]
n %= C[i]
print(ans)
if __name__ == "__main__":
main()
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,421 |
s211237811 | p02251 | u820842907 | 1586053863 | Python | Python3 | py | Accepted | 30 | 5600 | 188 | def Main():
n = int(input())
count = 0
cents = [25, 10, 5, 1]
for c in cents:
q, mod = divmod(n, c)
count += q
n -= c*q
print(count)
Main()
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,422 |
s085431976 | p02251 | u838900850 | 1585859317 | Python | Python3 | py | Accepted | 20 | 5596 | 181 | def main():
n = int(input())
coins = [25,10,5,1]
res = 0
for c in coins:
res+=n//c
n = n%c
print (res)
if __name__ == '__main__':
main()
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,423 |
s317400918 | p02251 | u240839092 | 1582737503 | Python | Python3 | py | Accepted | 20 | 5592 | 103 | coins = [25, 10, 5, 1]
n = int(input())
ans = 0
for i in coins:
ans += n//i
n %= i
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,424 |
s479849294 | p02251 | u123563150 | 1576918238 | Python | Python3 | py | Accepted | 20 | 5588 | 88 | n=int(input())
ans=0
ans+=n//25
n%=25
ans+=n//10
n%=10
ans+=n//5
n%=5
ans+=n
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,425 |
s141587037 | p02251 | u153447291 | 1575726026 | Python | Python3 | py | Accepted | 20 | 5588 | 109 | n = int(input())
ans = 0
ans += n//25
n = n%25
ans += n//10
n = n%10
ans += n//5
n = n%5
ans += n
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,426 |
s316067938 | p02251 | u784856415 | 1570784415 | Python | Python3 | py | Accepted | 20 | 5596 | 136 | n=int(input())
ans=0
a=[25,10,5,1]
for i in a:
if n<=0:
break
d=n//i
ans+=d
n-=i*d
#print(n,ans)
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,427 |
s795621602 | p02251 | u803862921 | 1569661235 | Python | Python3 | py | Accepted | 20 | 5600 | 113 | n = int(input())
C = [ 25, 10, 5, 1]
c = 0
for i in range(len(C)):
c += n//C[i]
n = n % C[i]
print(c)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,428 |
s463863715 | p02251 | u183700122 | 1568032817 | Python | Python3 | py | Accepted | 20 | 5592 | 92 | n = int(input())
ans = 0
for a in [25, 10, 5, 1]:
ans += n // a
n %= a
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,429 |
s675383464 | p02251 | u182175955 | 1566712888 | Python | Python3 | py | Accepted | 20 | 5588 | 96 | n=int(input())
c25=n//25
n%=25
c10=n//10
n%=10
c5=n//5
n%=5
ans = c25 + c10 + c5 + n
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,430 |
s611512820 | p02251 | u817810878 | 1565772927 | Python | Python3 | py | Accepted | 20 | 5600 | 356 | if __name__ == "__main__":
input_value = int(input())
twenty_five_n = input_value // 25
input_value = input_value - 25 * twenty_five_n
ten_n = input_value // 10
input_value = input_value - 10 * ten_n
five_n = input_value // 5
input_value = input_value - 5 * five_n
print(f"{twenty_five_n... | p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,431 |
s191408925 | p02251 | u199058613 | 1565487553 | Python | Python | py | Accepted | 10 | 4624 | 131 | n = int(raw_input())
coins = [25,10,5,1]
ans = 0
for coin in coins:
t = int(n / coin)
n -= t * coin
ans += t
print ans
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,432 |
s445359782 | p02251 | u212392281 | 1564876424 | Python | Python3 | py | Accepted | 20 | 5592 | 205 | n = int(input())
c2=0
c3=0
c4=0
c1 = int(n/25)
n = n - 25*c1
if n > 0:
c2 = int(n/10)
n = n - 10*c2
if n > 0:
c3 = int(n/5)
n = n - 5*c3
if n > 0:
c4 = n
print(c1+c2+c3+c4)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,433 |
s780613826 | p02251 | u811733736 | 1563017313 | Python | Python3 | py | Accepted | 20 | 5620 | 411 | # -*- coding: utf-8 -*-
"""
Greedy algorithms - Change Making
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_15_A&lang=jp
"""
import sys
def solve(n):
ans = 0
for c in (25, 10, 5, 1):
q, r = divmod(n, c)
ans += q
n = r
return ans
def main(args):
n = int(input... | p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,434 |
s160436580 | p02251 | u003684951 | 1562565149 | Python | Python3 | py | Accepted | 20 | 5592 | 86 | n = int(input())
ans = 0
for x in (25, 10, 5, 1):
ans += n // x
n %= x
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,435 |
s148561816 | p02251 | u051789695 | 1561898389 | Python | Python3 | py | Accepted | 20 | 5592 | 210 | n=int(input())
cnt=n
ans=0
cnt25=divmod(cnt,25)
ans+=cnt25[0]
cnt=cnt25[1]
cnt10=divmod(cnt,10)
ans+=cnt10[0]
cnt=cnt10[1]
cnt5=divmod(cnt,5)
ans+=cnt5[0]
cnt=cnt5[1]
cnt1=divmod(cnt,1)
ans+=cnt1[0]
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,436 |
s170612198 | p02251 | u902579831 | 1561896035 | Python | Python3 | py | Accepted | 20 | 5600 | 178 | n = int(input())
n_calc = n
C = [1, 5, 10, 25]
cnt = 0
for c in C[::-1]:
q, n_calc = divmod(n_calc, c)
cnt += q
if int(n_calc) == 0:
break
print(cnt)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,437 |
s212488674 | p02251 | u279605379 | 1561874413 | Python | Python3 | py | Accepted | 20 | 5588 | 99 | n= int(input())
ans = 0
a = n % 25
b = a % 10
c = b % 5
ans += n//25 + a//10 + b//5 + c
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,438 |
s015092842 | p02251 | u495152850 | 1561728422 | Python | Python3 | py | Accepted | 20 | 5592 | 86 | n = int(input())
ans = 0
for x in (25, 10, 5, 1):
ans += n // x
n %= x
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,439 |
s639577758 | p02251 | u653744760 | 1560840320 | Python | Python3 | py | Accepted | 20 | 5588 | 96 | n=int(input())
quarter=n//25
n=n%25
ten=n//10
n=n%10
five=n//5
n=n%5
print(quarter+ten+five+n)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,440 |
s152899317 | p02251 | u805716376 | 1556976720 | Python | Python3 | py | Accepted | 20 | 5592 | 101 | n = int(input())
many = [25, 10, 5, 1]
cnt = 0
for i in many:
cnt += n//i
n = n%i
print(cnt)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,441 |
s295990509 | p02251 | u800534567 | 1551050561 | Python | Python3 | py | Accepted | 20 | 5596 | 110 | import sys
n = int(sys.stdin.readline())
k = 0
for c in [25, 10, 5]:
k += n // c
n %= c
print(k+n)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,442 |
s532014205 | p02251 | u978863922 | 1549173641 | Python | Python3 | py | Accepted | 20 | 5600 | 433 | # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_15_A&lang=jp
# Greedy alogithms : python3
# 2019.2.3 yonezawa
import sys
input = sys.stdin.readline
#import cProfile
def main():
s = int(input())
cv = [25,10,5,1]
n = 0
for i in cv:
n += s // i
s = s % i
print (n)
... | p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,443 |
s266344884 | p02251 | u759934006 | 1549108396 | Python | Python3 | py | Accepted | 20 | 5592 | 101 | C = (25, 10, 5, 1)
n = int(input())
ans = 0
for c in C:
ans += n // c
n %= c
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,444 |
s777416730 | p02251 | u260980560 | 1548952400 | Python | Python3 | py | Accepted | 30 | 5584 | 107 | N = int(input())
ans = N // 25; N %= 25
ans += N // 10; N %= 10
ans += N // 5; N %= 5
ans += N
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,445 |
s628518524 | p02251 | u901678083 | 1548484729 | Python | Python3 | py | Accepted | 20 | 5596 | 143 | coins = [25,10,5,1]
n = int(input())
ans = 0
for coin in coins:
if n == 0:
break
else:
ans += int(n/coin)
n = n % coin
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,446 |
s421630715 | p02251 | u798803522 | 1546624205 | Python | Python3 | py | Accepted | 20 | 5592 | 119 | target = int(input())
coins = [25, 10, 5, 1]
ans = 0
for c in coins:
ans += target // c
target %= c
print(ans)
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,447 |
s166012702 | p02251 | u697145890 | 1544095042 | Python | Python3 | py | Accepted | 40 | 6360 | 315 | import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
COIN = [25,10,5,1]
N = int(input())
ans = 0
for i in range(len(COIN)):
ans += N//COIN[i]
N %= COIN[i]
print("%d"%(ans))
| p02251 | <h1>Change-Making Problem</h1>
<p>You want to make change for $n$ cents. Assuming that you have infinite supply of coins of 1, 5, 10 and/or 25 cents coins respectively, find the minimum number of coins you need.</p>
<h2>Input</h2>
<pre>
$n$
</pre>
<p>The integer $n$ is given in a line.</p>
<h2>出力</h2>
<p>Print th... | 100
| 4
| 30,448 |
s152140540 | p02254 | u880802684 | 1597649341 | Python | Python3 | py | Accepted | 60 | 6188 | 1,957 | # ハフマン符号
# https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/15/ALDS1_15_D
from collections import Counter
import heapq
class Node:
def __init__(self, count, val=None, left=None, right=None):
self.val = val
self.count = count
self.left = left
self.right = right
def __lt... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,449 |
s145370569 | p02254 | u759561356 | 1594014065 | Python | Python3 | py | Accepted | 30 | 6164 | 658 | from collections import Counter, deque
from heapq import heappush, heappop, heapify
C = Counter(input())
N = len(C)
if N == 1:
print(sum(C.values()))
exit(0)
G = [0] * (N * 2)
G[:N] = C
que = [(v, i) for i, v in enumerate(C.values())]
heapify(que)
cur = len(C)
while len(que) > 1:
v0, nd0 = heappop(q... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,450 |
s301842801 | p02254 | u512884261 | 1592669688 | Python | Python3 | py | Accepted | 40 | 6168 | 1,321 | import sys, collections, heapq
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): ... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,451 |
s802366615 | p02254 | u820842907 | 1586602002 | Python | Python3 | py | Accepted | 20 | 5868 | 1,448 | import heapq
code_list = dict()
class Node():
def __init__(self, alphabet, rate):
self.alphabet = alphabet
self.rate = rate
self.left = None
self.right = None
def create_code(node, target, code):
if node == None:
return
if node.alphabet == target:
co... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,452 |
s864661168 | p02254 | u371539389 | 1566583320 | Python | Python3 | py | Accepted | 50 | 6168 | 461 | from collections import Counter
S=input()
freq=sorted(list(dict(Counter(S)).items()),key=lambda w:w[1])
length={chr(ord('a')+i):0 for i in range(26)}
while len(freq)>1:
minimum1=freq.pop(0)
minimum2=freq.pop(0)
for c in minimum1[0]+minimum2[0]:
length[c]=length[c]+1
freq.append((minimum1[0]+min... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,453 |
s975315601 | p02254 | u199058613 | 1565925474 | Python | Python | py | Accepted | 30 | 5852 | 896 | import heapq
class Node:
def __init__(self, k, v):
self.k = k
self.v = v
self.left = None
self.right = None
def hist(s):
d = {}
for c in s:
if c not in d:
d[c] = 0
d[c] += 1
return d
S = raw_input()
D = hist(S)
pool = []
for k,v in D.items()... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,454 |
s285576407 | p02254 | u817810878 | 1565847154 | Python | Python3 | py | Accepted | 90 | 7384 | 1,558 | from typing import Dict
class Node():
left = None
right = None
parent = None
char = ''
value = 0
def __init__(self, char: str = '', value: int = 0) -> None:
self.char = char
self.value = value
def get_coded_str_len(node: Node, base_str: str) -> int:
if node.char:
... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,455 |
s152996700 | p02254 | u088630381 | 1564055883 | Python | Python3 | py | Accepted | 90 | 5880 | 989 | import heapq
S = input()
# 数え上げ
chars = [[0, n] for n in range(256)]
for s in S:
chars[ord(s)][0] += 1
# ハフマン木生成
# :ノードの構造:[count, char, left=None, right=None]
# :[1]のcharは、heapqでユニークキーとして機能するように追加した
counts = []
for char in chars:
if not char[0]:
continue
heapq.heappush(counts, [char[0], char[1], None, None, ch... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,456 |
s201818738 | p02254 | u811733736 | 1563019589 | Python | Python3 | py | Accepted | 40 | 7432 | 1,075 | # -*- coding: utf-8 -*-
"""
Greedy algorithms - Huffman Coding
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_15_D&lang=jp
"""
import sys
from collections import Counter
class Node:
def __init__(self, v, f):
self.val = v
self.freq = f
self.left = None
self.right = N... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,457 |
s343893466 | p02254 | u902579831 | 1561969590 | Python | Python3 | py | Accepted | 30 | 5744 | 859 | S = input()
dict_string = {}
dict_depth = {}
for s in S:
if s in dict_string:
dict_string[s] += 1
else:
dict_string[s] = 1
dict_depth[s] = 0
dict_string_calc = dict_string.copy()
while len(dict_string_calc) != 1:
x = None
y = None
for k, v in sorted(dict_string_calc.i... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,458 |
s586692170 | p02254 | u805716376 | 1557037785 | Python | Python3 | py | Accepted | 20 | 5872 | 792 | from heapq import *
class Node():
def __init__(self, key, char=None):
self.key = key
self.char = char
self.pare = None
st = input()
_st = list(set(st))
a = []
for i in _st:
a += [(st.count(i),i)]
heapify(a)
node = {}
for i in range(len(a)):
cnt, char = a[i]
node[char] = Node... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,459 |
s334864890 | p02254 | u182180701 | 1551967211 | Python | Python3 | py | Accepted | 60 | 7260 | 1,268 | import heapq
from collections import Counter
class HuffmanTreeNode:
def __init__(self, char, freq):
self.char = char
self.freq = freq
self.left = None
self.right = None
def __lt__(self, other):
return self.freq < other.freq
def huffman_code_helper(root, code='', ... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,460 |
s712789904 | p02254 | u759934006 | 1549122646 | Python | Python3 | py | Accepted | 70 | 5788 | 865 | class Node():
p = None
l = None
r = None
char = ''
count = 0
def __init__(self, char='', count=0):
self.char = char
self.count = count
def solve(n, h):
if n.char:
# print('{}:{}'.format(n.char, h))
return len(h) * n.count
else:
ret = 0
i... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,461 |
s130179812 | p02254 | u260980560 | 1548979542 | Python | Python3 | py | Accepted | 40 | 6164 | 639 | from collections import Counter, deque
from heapq import heappush, heappop, heapify
C = Counter(input())
N = len(C)
if N == 1:
print(sum(C.values()))
exit(0)
G = [0]*(N*2)
G[:N] = C
que = [(v, i) for i, v in enumerate(C.values())]
heapify(que)
cur = len(C)
while len(que) > 1:
v0, nd0 = heappop(que)
... | p02254 | <h1>Huffman Coding</h1>
<p>We want to encode a given string $S$ to a binary string. Each alphabet character in $S$ should be mapped to a different variable-length code and the code must not be a prefix of others.</p>
<p>Huffman coding is known as one of ways to obtain a code table for such encoding.</p>
<p>For example... | abca
| 6
| 30,462 |
s802159013 | p02255 | u986487972 | 1530788085 | Python | Python3 | py | Accepted | 20 | 5604 | 321 |
n = int(input())
a = list(map(int,input().split()))
print(" ".join(list(map(str,a))))
def insertionSort(A,N):
for i in range(1,N):
v = A[i]
j = i-1
while j>=0 and A[j]>v:
A[j+1]=A[j]
j-=1
A[j+1]=v
print(" ".join(list(map(str,A))))
insertionSort(a,n)... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,463 |
s664158188 | p02255 | u806005289 | 1530794351 | Python | Python3 | py | Accepted | 20 | 5600 | 1,048 | length=int(input())
firstArray=input()
listForArray=list(map(int,firstArray.split()))
listForPrint=[firstArray]
def insertionSort(list,length):
index=1
while index<length:
if listForArray[index]<=listForArray[index-1]:
for index2 in range(0,index):
if listForArray[index2-1]... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,464 |
s951196141 | p02255 | u938878704 | 1530931208 | Python | Python3 | py | Accepted | 20 | 5604 | 372 | N = int(input())
a = [int(x) for x in input().split()]
for i in range(0, len(a)) :
repl = i
cur_num = a[i]
# fetch idx to replace
for j in range(i, -1, -1) :
if a[j] >= a[i] :
repl = j
# shift
for k in range(i, repl - 1, -1) :
a[k] = a[k - 1]
a[rep... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,465 |
s595946074 | p02255 | u313089641 | 1531154862 | Python | Python3 | py | Accepted | 20 | 5608 | 345 | number = int(input())
cards = list(map(int, input().split()))
def insertionSort(A, N):
print(" ".join(map(str, A)))
for i in range(1, N):
j = i - 1
while A[j] > A[i] and j >= 0:
A[i], A[j] = A[j], A[i]
j -= 1
i -= 1
print(" ".join(map(str, A)))
inse... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,466 |
s366905258 | p02255 | u888550928 | 1531478427 | Python | Python3 | py | Accepted | 20 | 5600 | 365 | def insertionSort(A, N):
for i in range(N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
B = A.copy()
for t in range(N):
B[t] = str(B[t])
print(" ".join(B))
n = int(input())
a = list(ma... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,467 |
s856478280 | p02255 | u539753516 | 1531541231 | Python | Python3 | py | Accepted | 20 | 5976 | 191 | n=int(input())
a=list(map(int,input().split()))
print(*a)
for i in range(1,n):
v=a[i]
j=i-1
while j>=0 and a[j]>v:
a[j+1]=a[j]
j-=1
a[j+1]=v
print(*a)
| p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,468 |
s777422764 | p02255 | u637322311 | 1531559644 | Python | Python3 | py | Accepted | 30 | 5976 | 344 | def print_list(A):
print(*A, sep=" ")
def insertion_sort(A, n):
print_list(A)
for i in range(1, n):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print_list(A)
n = int(input())
A = list(map(int,input().split())... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,469 |
s562371351 | p02255 | u400765446 | 1531583928 | Python | Python3 | py | Accepted | 30 | 5980 | 526 | def main():
n = int(input())
Mtx = list(map(int, input().split()))
showMtx(Mtx)
for i in range(1,n):
for j in range(i,0,-1):
if Mtx[j] < Mtx[j-1]:
Mtx[j-1], Mtx[j] = Mtx[j], Mtx[j-1]
# print(i, j, sep=', ')
showMtx(Mtx)
def s... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,470 |
s164681028 | p02255 | u400765446 | 1531584045 | Python | Python3 | py | Accepted | 30 | 5972 | 566 | def main():
n = int(input())
Mtx = list(map(int, input().split()))
showMtx(Mtx)
for i in range(1,n):
for j in range(i,0,-1):
if Mtx[j] < Mtx[j-1]:
Mtx[j-1], Mtx[j] = Mtx[j], Mtx[j-1]
else:
break
# print(i, j, sep=', ')
... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,471 |
s432633848 | p02255 | u715990255 | 1531728700 | Python | Python3 | py | Accepted | 20 | 5604 | 635 | n = int(input())
nums = list(map(int, input().split()))
def insertion_sort(lis, num):
print(' '.join(map(str, lis)))
for i in range(1, num):
v = lis[i]
j = i - 1 # j は iの前の数
while j >= 0 and lis[j] > v: # jが0以上で配列のj番目の要素が現在の要素より大きい場合
lis[j + 1] = lis[j] # 配列j+1番目の要素に配列j番目... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,472 |
s853210265 | p02255 | u302561071 | 1531825576 | Python | Python | py | Accepted | 10 | 4668 | 498 | import sys
n = input()
sort_list = list()
sort_list = map(int, raw_input().split())
for i in range(0,n):
tmp = sort_list[i]
j = i - 1
while j >= 0 and sort_list[j] > tmp:
sort_list[j+1] = sort_list[j]
j = j - 1
sort_list[j+1] = tmp
for k in range(0,n):
sys.std... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,473 |
s105481326 | p02255 | u123669391 | 1531992094 | Python | Python3 | py | Accepted | 30 | 5976 | 357 | def show (nums):
for i in range(len(nums)):
if i!=len(nums)-1:
print(nums[i],end=' ')
else :
print(nums[i])
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
for j in range(i):
if a[j] > a[i]:
a.insert(j, a[i])
a.pop... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,474 |
s804145600 | p02255 | u487861672 | 1531995772 | Python | Python3 | py | Accepted | 20 | 5612 | 375 | #! /usr/local/bin/python3
# coding: utf-8
def insertion_sort(a):
for i in range(1, len(a)):
print(" ".join(map(str, a)))
w = a[i]
j = i - 1
while j >= 0 and w < a[j]:
a[j + 1] = a[j]
j -= 1
a[j + 1] = w
n = int(input())
a = [int(i) for i in input().s... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,475 |
s088287509 | p02255 | u487861672 | 1531996271 | Python | Python3 | py | Accepted | 20 | 5612 | 376 | #! /usr/local/bin/python3
# coding: utf-8
def insertion_sort(a):
for i in range(1, len(a)):
print(" ".join(map(str, a)))
w = a[i]
j = i - 1
while j >= 0 and w < a[j]:
a[j + 1] = a[j]
j -= 1
a[j + 1] = w
n = int(input())
a = [int(i) for i in input().s... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,476 |
s434661727 | p02255 | u578148790 | 1532093516 | Python | Python3 | py | Accepted | 20 | 5612 | 266 | n = int(input())
a = [int(i) for i in input().split()]
print(' '.join([str(i) for i in a]))
for i in range(1, n):
v = a[i]
j = i - 1
while j >= 0 and a[j] > v:
a[j+1] = a[j]
j -= 1
a[j+1] = v
print(' '.join([str(i) for i in a]))
| p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,477 |
s155674857 | p02255 | u481175672 | 1532109874 | Python | Python3 | py | Accepted | 20 | 5984 | 193 | n = int(input())
*A, = map(int, input().split())
for i in range(n):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print(*A)
| p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,478 |
s609232052 | p02255 | u578148790 | 1532174215 | Python | Python3 | py | Accepted | 20 | 5604 | 347 | def insertion_sort(a, n):
for i in range(1, n):
v = a[i]
j = i - 1
while j >= 0 and a[j] > v:
a[j+1] = a[j]
j -= 1
a[j+1] = v
print(' '.join([str(i) for i in a]))
n = int(input())
a = [int(i) for i in input().split()]
print(' '.join([str(i) for i in ... | p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,479 |
s324812593 | p02255 | u146066538 | 1534934227 | Python | Python3 | py | Accepted | 20 | 5600 | 261 | # coding: utf-8
n = int(input())
A = list(map(int, input().split()))
print(" ".join(map(str,A)))
for i in range(1,n):
v = A[i]
j = i -1
while j >= 0 and A[j] > v:
A[j+1] = A[j]
j -= 1
A[j+1] = v
print(" ".join(map(str,A)))
| p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,480 |
s009968662 | p02255 | u362520072 | 1535020124 | Python | Python3 | py | Accepted | 20 | 5600 | 296 | def insertionSort(A, N):
print(' '.join(map(str, A)))
for i in range(1, N):
v = A[i]
j = i - 1
while j >= 0 and A[j] > v:
A[j + 1] = A[j]
j -= 1
A[j + 1] = v
print(' '.join(map(str, A)))
N = int(input())
A = list(map(int, input().split()))
insertionSort(A,N)
| p02255 |
<H1>Insertion Sort</H1>
<p>
Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode:
</p>
<pre>
for i = 1 to A.length-1
key = A[i]
/* insert A[i] into the sorted sequence A[0,...,j-1] */
j = i - 1
while j >... | 6
5 2 4 6 1 3
| 5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6
| 30,481 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.