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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s583726266 | p00029 | u228556128 | 1591964246 | Python | Python3 | py | Accepted | 30 | 5968 | 139 | import collections
n=input().split()
c=collections.Counter(n)
dic={i: len(i) for i in n}
print(c.most_common()[0][0],max(dic,key=dic.get))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,602 |
s512697983 | p00029 | u814278309 | 1591879437 | Python | Python3 | py | Accepted | 20 | 5544 | 63 | n = input().split()
print(max(n, key=n.count),max(n, key=len))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,603 |
s316885898 | p00029 | u903393228 | 1591622055 | Python | Python3 | py | Accepted | 20 | 5552 | 193 | l = input().split()
s = set(l)
a = 0
b = 0
J = ''
K = ''
for i in s:
if l.count(i) > a:
a = l.count(i)
J = i
if len(i) > b:
b = len(i)
K = i
print(J,K)
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,604 |
s378132366 | p00029 | u921537862 | 1591609290 | Python | Python3 | py | Accepted | 30 | 5956 | 384 | import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
from collections import deque,defaultdict,Counter
def main():
S = input().split()
S[0] = S[0].lower()
c = Counter(S)
often = sorted(list(c.items()),key = lambda x:-x[1])[0][0]
longest = sorted(list(c.keys()),key = len)[-1]... | p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,605 |
s431250811 | p00029 | u742290340 | 1591609163 | Python | Python3 | py | Accepted | 20 | 5556 | 262 | a= list(input().split())
b={}
for w in a:
if not(w in b):
b[w]=1
else:
b[w]+=1
max_word=" "
max_num= a[0]
for w in b:
if len(max_word)< len(w):
max_word= w
if b[w]> b[max_num]:
max_num= w
print(max_num,max_word)
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,606 |
s081128077 | p00029 | u842461513 | 1591401843 | Python | Python3 | py | Accepted | 20 | 5540 | 205 | #標準入力
line = list(input().split())
#max関数を使いkeyを引数に設定し、最瀕の単語と、文字数の長い単語を出力する
print(max(line,key = line.count),max(line,key = len))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,607 |
s190477110 | p00029 | u286298310 | 1590771261 | Python | Python3 | py | Accepted | 20 | 5536 | 71 | a = list(input().split())
print(max(a, key=a.count), max(a, key=len))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,608 |
s438200947 | p00029 | u240091169 | 1590647101 | Python | Python3 | py | Accepted | 20 | 5652 | 585 | from operator import itemgetter
sentence = list(input().split())
max_length = 0
max_sentence = ""
count = []
for i in range(len(sentence)) :
if max_length < len(sentence[i]) :
max_length = len(sentence[i])
max_sentence = sentence[i]
new_word = False
for j in range(len(count)) :
if co... | p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,609 |
s359218376 | p00029 | u747915832 | 1590258519 | Python | Python3 | py | Accepted | 20 | 5560 | 234 | text = list(input().split())
count = []
length = []
for i in range(len(text)):
count.append(text.count(text[i]))
length.append(len(text[i]))
c = count.index(max(count))
l = length.index(max(length))
print(text[c],text[l])
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,610 |
s733981485 | p00029 | u580977620 | 1589869922 | Python | Python3 | py | Accepted | 20 | 5564 | 552 | word_list = input().split(' ')
word_dict = {}
longest_word_len = 0
longest_word = ''
high_freq_word_num = 0
for word in word_list:
if longest_word_len < len(word):
longest_word_len = len(word)
longest_word = word
if word not in word_dict:
word_dict[word] = 1
else :
word_... | p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,611 |
s981826099 | p00029 | u260980560 | 1589610645 | Python | Python3 | py | Accepted | 30 | 5964 | 235 | from collections import Counter
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def solve():
s = readline()
c = Counter(s.split())
write("%s %s\n" % (max(c, key=lambda x: c[x]), max(c, key=len)))
solve()
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,612 |
s487706441 | p00029 | u037441960 | 1589526229 | Python | Python3 | py | Accepted | 20 | 5560 | 259 | S = input().split()
l = 0
n = 0
L = "a"
N = "a"
for i in range(len(S)) :
if S.count(S[i]) > n :
n = S.count(S[i])
N = S[i]
for i in range(len(S)) :
if len(S[i]) > l :
l = len(S[i])
L = S[i]
print(N, L)
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,613 |
s663949638 | p00029 | u014861569 | 1589011879 | Python | Python3 | py | Accepted | 20 | 5556 | 267 | n=list(map(str,input().split()))
s=0
t=0
p=[]
q=[]
for i in range(0,len(n)):
d=n.count(n[i])
if d>s:
p.append(n[i])
s=d
else:
pass
if len(n[i])>t:
q.append(n[i])
t=len(n[i])
p=p[::-1]
q=q[::-1]
print(p[0],q[0])
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,614 |
s225612686 | p00029 | u630911389 | 1585760718 | Python | Python3 | py | Accepted | 20 | 5564 | 351 | dic = dict()
maxWords = ""
words = list(x for x in input().split())
for w in words:
if len(w) > len(maxWords):
maxWords = w
value = dic.get(w)
if not value:
dic.setdefault(w,1)
else:
dic.update({w:value + 1})
dic = dict(sorted(dic.items(), key=lambda x: x[1],reverse=True))
print... | p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,615 |
s391623469 | p00029 | u808372529 | 1584076613 | Python | Python3 | py | Accepted | 20 | 5964 | 152 | from collections import Counter
sentence = input().split()
cnt = Counter(sentence)
print(cnt.most_common(1)[0][0], max(sentence, key=lambda x: len(x)))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,616 |
s598103229 | p00029 | u371539389 | 1581587468 | Python | Python3 | py | Accepted | 30 | 5956 | 226 | from collections import Counter
s=input()
s=s.lower()
s=s.split(" ")
long=sorted(s,key=lambda w:len(w),reverse=True)
freq=dict(Counter(s)).items()
freq=sorted(freq,key=lambda w:w[1],reverse=True)
print(freq[0][0],long[0])
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,617 |
s277436626 | p00029 | u299931928 | 1579779471 | Python | Python3 | py | Accepted | 20 | 5560 | 305 | # ライブラリのインポート
#import re #正規表現
import sys
#import heapq
#import collections
#import math
def main():
y = ""
for x in sys.stdin: y += x
a = list(y.strip("\n").split(" "))
print(max(a, key=a.count), max(a, key=len))
if __name__ == '__main__':
main()
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,618 |
s534837824 | p00029 | u350155409 | 1573879434 | Python | Python3 | py | Accepted | 20 | 5560 | 263 | dic = {}
max_num = 0
max_word = ""
for word in input().split():
if word in dic:
dic[word] += 1
else:
dic[word] = 1
if max_num <= len(word):
max_num = len(word)
max_word = word
print(max(dic, key=dic.get), max_word)
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,619 |
s315313736 | p00029 | u606731189 | 1570956794 | Python | Python3 | py | Accepted | 20 | 5552 | 497 | s=list(input().split())
num1=1
tmp1=0
for i in range(len(s)):
if tmp1>num1: #出現頻度が高い
#print("tmp1",tmp1)
num1=tmp1
list1=s[i-1]
tmp1=0
for m in range(len(s)):
if s[i]==s[m]:
tmp1+=1
for l in range(len(s)-1): ... | p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,620 |
s434707555 | p00029 | u290671130 | 1568030171 | Python | Python3 | py | Accepted | 20 | 5552 | 280 | s = input().split()
len_id = 0; max_len = 0
cnt_id = 0; max_cnt = 0
for i in range(len(s)):
l = len(s[i])
c = s.count(s[i])
if l > max_len:
max_len = l
len_id = i
if c > max_cnt:
max_cnt = c
cnt_id = i
print(s[cnt_id], s[len_id])
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,621 |
s568750016 | p00029 | u824708460 | 1566306269 | Python | Python3 | py | Accepted | 20 | 5560 | 191 | text = input().split()
l = {}
dc = {}
for i in text:
l[i] = len(i)
if i in dc.keys():
dc[i] += 1
else:
dc[i] = 0
print(max(dc, key=dc.get), max(l, key=l.get))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,622 |
s229442419 | p00029 | u108130680 | 1564927672 | Python | Python3 | py | Accepted | 20 | 5540 | 70 | a = list(input().split())
print(max(a, key=a.count), max(a, key=len))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,623 |
s099241671 | p00029 | u427219397 | 1564898076 | Python | Python3 | py | Accepted | 20 | 5540 | 81 | list = input().split()
print(max(list, key=list.count), max(list, key=len))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,624 |
s621485897 | p00029 | u804558166 | 1564508476 | Python | Python3 | py | Accepted | 20 | 5540 | 79 | list = input().split()
print(max(list, key=list.count), max(list, key=len))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,625 |
s344826239 | p00029 | u314166831 | 1563977780 | Python | Python3 | py | Accepted | 20 | 5652 | 3,124 | # 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... | p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,626 |
s449056104 | p00029 | u548252256 | 1562169176 | Python | Python3 | py | Accepted | 30 | 5968 | 171 | from collections import Counter
if __name__ == '__main__':
A = input().split()
c = Counter(A)
ans = c.most_common(1)
print(ans[0][0],max(A,key=len))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,627 |
s172077843 | p00029 | u026821956 | 1560054734 | Python | Python3 | py | Accepted | 20 | 5564 | 366 | s = list(map(str,input().split()))
dict = {}
for n in s:
if n in dict:
dict[n] += 1
else:
dict[n] = 1
long_word = ''
freq_word = ''
max_len = 0
max_fre = 0
for k,v in dict.items():
if max_len < len(k):
long_word = k
max_len = len(k)
if max_fre < v:
freq_word = k
... | p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,628 |
s732599226 | p00029 | u625806423 | 1557144054 | Python | Python3 | py | Accepted | 30 | 5964 | 313 | from collections import Counter
dic_str = {}
strings = input().split()
dic_str = Counter(strings)
key_max = 0
val_max = 0
key_str = ''
val_str = ''
for k,v in dic_str.items():
if len(k) > key_max:
key_max = len(k)
key_str = k
if v > val_max:
val_max = v
val_str = k
print(val_str, key_str)
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,629 |
s456678108 | p00029 | u406093358 | 1555549156 | Python | Python | py | Accepted | 10 | 4656 | 453 | wordlist = raw_input().split()
maxlength = 0
lengthindex = -1
for i in range(0, len(wordlist)):
length = len(wordlist[i])
if maxlength < length:
maxlength = length
lengthindex = i
longest = wordlist[lengthindex]
wordlist.sort()
max = 0
cnt = 0
tmp = ''
modeword = ''
for i in range(0, len(wordlist)):
if wordlist[... | p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,630 |
s764617533 | p00029 | u998437062 | 1554717074 | Python | Python3 | py | Accepted | 30 | 5956 | 303 | from collections import Counter
seq = list(input().split())
mode_word = ''
cnt = 0
for k, v in Counter(seq).items():
if cnt < v:
mode_word = k
cnt = v
max_count_word = ''
for s in seq:
if len(max_count_word) < len(s):
max_count_word = s
print(mode_word, max_count_word)
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,631 |
s783412288 | p00029 | u054800243 | 1554714032 | Python | Python3 | py | Accepted | 30 | 5972 | 230 | # coding: utf-8
from collections import Counter
s = input().strip().split(" ")
most_freq = Counter(s).most_common()[0][0]
max_len = sorted([(len(x), x)for x in s], reverse=True)[0][1]
print("{} {}".format(most_freq, max_len))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,632 |
s733454463 | p00029 | u990228206 | 1553162356 | Python | Python3 | py | Accepted | 30 | 5964 | 199 | import collections
s=list(map(str,input().split()))
nc=collections.Counter(s)
ans_most=nc.most_common(1)[0][0]
ans_long=""
for i in s:
if len(ans_long)<len(i):ans_long=i
print(ans_most,ans_long)
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,633 |
s180151717 | p00029 | u689047545 | 1547959369 | Python | Python3 | py | Accepted | 20 | 5548 | 317 | if __name__ == '__main__':
maxL = 0
maxF = 0
strlst = list(map(str, input().split()))
for s in strlst:
if strlst.count(s) > maxF:
maxF = strlst.count(s)
maxFans = s
if len(s) > maxL:
maxL = len(s)
maxLans = s
print(maxFans, maxLans)
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,634 |
s585339453 | p00029 | u563075864 | 1543032989 | Python | Python3 | py | Accepted | 20 | 5572 | 296 | text = input().split()
dic = dict(zip(text,[0 for i in range(len(text))]))
for i in text:
dic[i] = dic[i] + 1
max_ = max(dic.values())
for key,value in dic.items():
if value == max_:
most = key
max_ = 0
for i in dic.keys():
if len(i) > max_:
max_ = len(i)
amax_ = i
print(most, amax_)
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,635 |
s715732726 | p00029 | u067299340 | 1542262949 | Python | Python3 | py | Accepted | 40 | 6952 | 134 | from statistics import *
words = [w.lower() for w in input().split()]
words.sort(key=len, reverse=True)
print(mode(words), words[0])
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,636 |
s425160635 | p00029 | u717526540 | 1541725252 | Python | Python3 | py | Accepted | 20 | 5964 | 216 | import collections
slist = list(map(str, input().split()))
sc = collections.Counter(slist)
common = sc.most_common()[0][0]
max = ""
for s in slist:
if len(max) < len(s):
max = s
print(common, max)
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,637 |
s842188766 | p00029 | u833357551 | 1541391964 | Python | Python3 | py | Accepted | 20 | 5544 | 68 | s = list(input().split())
print(max(s,key=s.count), max(s,key=len))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,638 |
s517368229 | p00029 | u098862429 | 1538982506 | Python | Python3 | py | Accepted | 20 | 5536 | 79 | list = input().split()
print(max(list, key=list.count), max(list, key=len))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,639 |
s127301502 | p00029 | u158979022 | 1538982097 | Python | Python3 | py | Accepted | 20 | 5540 | 70 | s = list(input().split())
print(max(s, key=s.count), max(s, key=len))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,640 |
s244471413 | p00029 | u219940997 | 1537459955 | Python | Python3 | py | Accepted | 30 | 5972 | 244 | from collections import Counter
def process(line):
longest = sorted(line, key=len)
c = Counter(line)
count = c.most_common(1)
return count[0][0], longest[-1]
line = input().split()
a, b = process(line)
print('{} {}'.format(a, b))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,641 |
s375823565 | p00029 | u252700163 | 1537295043 | Python | Python3 | py | Accepted | 20 | 5568 | 310 | x = input().lower()
term_data = {}
for word in x.split():
if term_data.get(word) is None:
term_data[word] = [0, len(word)]
term_data[word][0] += 1
term_data = [(term, data) for term, data in term_data.items() ]
print(max(term_data, key=lambda x:x[1][0])[0], max(term_data, key=lambda x:x[1][1])[0] )
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,642 |
s234273034 | p00029 | u546285759 | 1536291906 | Python | Python3 | py | Accepted | 30 | 5960 | 153 | from collections import Counter
sentence = input().split()
cnt = Counter(sentence)
print(cnt.most_common(1)[0][0], max(sentence, key=lambda x: len(x)))
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,643 |
s463232906 | p00029 | u319725914 | 1534296039 | Python | Python3 | py | Accepted | 30 | 5964 | 179 | from collections import Counter
s = list(input().split())
c = Counter(s)
n,m = 0,0
for e in s:
if n < len(e):
n = len(e)
m = e
print(c.most_common()[0][0],m)
| p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,644 |
s003105620 | p00029 | u079141094 | 1517459944 | Python | Python3 | py | Accepted | 20 | 5560 | 488 | def solve():
text = input()
longest, length = '', 0
dic = {}
for word in text.split():
if word in dic.keys():
dic[word] += 1
else:
dic[word] = 1
if length < len(word):
longest = word
length = len(word)
target, cnt ... | p00029 |
<H1>English Sentence</H1>
<p>
Your task is to write a program which reads a text and prints two words. The first one is the word which is arise most frequently in the text. The second one is the word which has the maximum number of letters.
</p>
<p>
The text includes only alphabetical characters and spaces. A word i... | Thank you for your mail and your lectures
| your lectures
| 8,645 |
s178930722 | p00030 | u471400255 | 1530977522 | Python | Python3 | py | Accepted | 20 | 5632 | 251 | from itertools import combinations
while True:
n,s = [int(i) for i in input().split()]
if (n, s) == (0, 0):
break
ans = 0
for num in combinations(range(10),n):
if sum(num) == s:
ans += 1
print(ans)
| p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,646 |
s117020169 | p00030 | u525366883 | 1535681110 | Python | Python | py | Accepted | 10 | 4736 | 223 | import itertools
l=range(10)
while True:
n,s=map(int, raw_input().split())
if n==0:
break
cnt=0
for i in list(itertools.combinations(l,n)):
if s == sum(i):
cnt+=1
print cnt
| p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,647 |
s966532907 | p00030 | u193025715 | 1408269842 | Python | Python3 | py | Accepted | 40 | 6724 | 205 | import itertools
while True:
n, s = map(int, input().split(' '))
if n + s == 0: break
ans = 0
for i in itertools.combinations(range(10), n):
if sum(i) == s: ans += 1
print(ans) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,648 |
s064129107 | p00030 | u579833671 | 1410773046 | Python | Python | py | Accepted | 20 | 4224 | 379 | ans = 0
def count(use, sum, n, s):
global ans
if(sum > s or n < 0):
return;
if(n == 0 and s == sum):
ans += 1
else:
for i in range(use + 1, 10):
count(i, sum + i, n - 1, s)
while(True):
n = map(int, raw_input().split())
ans = 0
if(n[0] == 0 and n[1] == 0)... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,649 |
s133197421 | p00030 | u506132575 | 1416191802 | Python | Python | py | Accepted | 20 | 4388 | 280 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import itertools
for s in sys.stdin:
d = map( int, s.split() )
if d == [ 0,0 ]:
break
n, s = d[0], d[1]
lis = list(itertools.combinations(range(10),d[0]))
print sum( [ 1 for e in lis if sum(e) == d[1] ] )
| p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,650 |
s144391657 | p00030 | u617183767 | 1418004239 | Python | Python | py | Accepted | 10 | 4356 | 1,324 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import itertools
class Hoge(object):
def __init__(self):
pass
def func(self):
'''
insert your code
'''
while True:
n, s = map(int, raw_input().split())
if n == 0 and s == 0... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,651 |
s190422142 | p00030 | u316268279 | 1418004243 | Python | Python3 | py | Accepted | 30 | 6736 | 390 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import itertools
S = []
N = []
while True:
n,s = map(int,input().split(" "))
if s == 0 and n == 0:
break
else:
N.append(n)
S.append(s)
for i in range(0,len(S)):
sumMap = list(map(sum,list(itertools.combinations(range(0,10),N[i]))))
... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,652 |
s261249351 | p00030 | u567380442 | 1423028235 | Python | Python3 | py | Accepted | 30 | 6728 | 224 | import sys
f = sys.stdin
import itertools
while True:
n, s = map(int, f.readline().split())
if n == 0:
break
print(sum(1 for nums in itertools.combinations([i for i in range(10)], n) if sum(nums) == s)) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,653 |
s221423275 | p00030 | u929523932 | 1424954777 | Python | Python3 | py | Accepted | 40 | 6728 | 235 | import sys
import itertools
for line in sys.stdin:
(n, s) = map(int, line.split(" "))
if n == 0 and s == 0:
break
cnt = 0
for v in itertools.combinations(range(10), n):
cnt += sum(v) is s
print(cnt) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,654 |
s610725084 | p00030 | u540744789 | 1426570966 | Python | Python | py | Accepted | 20 | 4216 | 332 | def sum_count(n,s,r):
count = 0
if n==1:
if (r<=s and s<=9):
return 1
else:
return 0
else:
return sum([sum_count(n-1,s-i,i+1) for i in range(r,9)])
while True:
n,s=map(int,raw_input().split(" "))
if n==0 and s==0:
break
print sum_count... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,655 |
s574125067 | p00030 | u886766186 | 1431859949 | Python | Python | py | Accepted | 20 | 4212 | 321 | def dfs(pos, t, sum):
global cnt
if t == n:
if sum == s:
cnt += 1
return
if pos > 9:
return
dfs(pos+1, t, sum)
dfs(pos+1, t+1, sum + pos)
while True:
n, s = map(int, raw_input().split())
if n==0 and s==0: break
cnt = 0
dfs(0, 0, 0)
print cn... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,656 |
s189725012 | p00030 | u358879127 | 1432035639 | Python | Python | py | Accepted | 10 | 4224 | 274 |
dp = [[0] * 101 for _ in range(11)]
def dfs(n, p, s):
if p == 10:
return
for i in range(n, 10):
dp[p][s + i] += 1
dfs(i + 1, p + 1, s + i)
dfs(0, 0, 0)
while True:
l = map(int, raw_input().split())
if l[0] == 0 and l[1] == 0:
break
print dp[l[0] - 1][l[1]] | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,657 |
s190950609 | p00030 | u505648358 | 1432037405 | Python | Python | py | Accepted | 20 | 4212 | 292 | def solve(n, s, low):
if n == 0:
return 1 if s == 0 else 0
res = 0
for i in range(low,10):
if s - i < 0: break
res += solve(n-1, s-i, i+1)
return res
while True:
n, s = map(int, raw_input().split(' '))
if n == 0: break
print solve(n, s, 0) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,658 |
s810353316 | p00030 | u873482706 | 1434610142 | Python | Python | py | Accepted | 20 | 4240 | 537 | def move(move_count, add, flag):
for i in range(move_count):
n_lis.append(num_lis[add+i])
if flag == n:
calculate()
del n_lis[-1]
else:
move(move_count-i-1, add+i+1, flag+1)
del n_lis[-1]
def calculate():
global count
if sum(n_lis)... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,659 |
s537594492 | p00030 | u873482706 | 1434615213 | Python | Python | py | Accepted | 20 | 4240 | 557 | def move(move_count, current, flag):
for i in range(move_count):
n_lis.append(num_lis[current+i])
if flag == n:
calculate()
del n_lis[-1]
else:
move(move_count-i-1, current+i+1, flag+1)
del n_lis[-1]
def calculate():
global cou... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,660 |
s854212476 | p00030 | u873482706 | 1434615392 | Python | Python | py | Accepted | 20 | 4232 | 585 | def move(move_count, current, flag):
for i in range(move_count):
n_lis.append(num_lis[current+i])
if flag == n:
calculate()
del n_lis[-1]
else:
move(move_count, current+i+1, flag+1)
move_count -= 1
del n_lis[-1]
def cal... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,661 |
s959189456 | p00030 | u140201022 | 1447082827 | Python | Python | py | Accepted | 10 | 6536 | 216 | import itertools
l=range(10)
while 1:
n,s=map(int, raw_input().split())
if n==0:
break
cnt=0
for i in list(itertools.combinations(l,n)):
if sum(i)==s:
cnt+=1
print cnt | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,662 |
s536681635 | p00030 | u489809100 | 1447683669 | Python | Python | py | Accepted | 20 | 6320 | 226 | import itertools
while True:
n,s = map(int,raw_input().split())
if n == 0 and s == 0:
break
count = 0
num = list(itertools.combinations(xrange(10), n))
for var in num:
if sum(var) == s:
count += 1
print count | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,663 |
s737007900 | p00030 | u775586391 | 1448353195 | Python | Python3 | py | Accepted | 40 | 7748 | 252 | def f(n,s,x):
if n == s == 0:
return 1
elif n == 0 or x == 0:
return 0
else:
a = 0
for i in range(x):
a += f(n-1,s-i,i)
return a
while True:
n,s = map(int,input().split())
if n == s == 0:
break
print(f(n,s,10)) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,664 |
s813425252 | p00030 | u461370825 | 1449745818 | Python | Python | py | Accepted | 30 | 6432 | 340 | from math import *
PI = 3.1415926535898
def dfs(i, su, cnt, s):
if su == s and cnt == 0:
return 1
if i == 10 or cnt == 0:
return 0
return dfs(i+1, su, cnt, s) + dfs(i+1, su+i, cnt-1, s)
while True:
try:
n, s = map(int, raw_input().strip().split())
if n == 0 and s == 0:
break
print dfs(0, 0, n, s)
exce... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,665 |
s338451369 | p00030 | u529386725 | 1452712127 | Python | Python | py | Accepted | 20 | 6248 | 490 | cnt = 0
li = range(10)
n, s = 0, 0
def dfs(i, num, total):
global cnt
if i <= 10 and num == n and total == s:
#answer is finded
cnt += 1
return;
if i >= 10 or num > n or total > s:
#out of range
return;
#when use i
dfs(i+1, num+1, total+i)
#when ... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,666 |
s091950983 | p00030 | u650459696 | 1459352090 | Python | Python3 | py | Accepted | 20 | 7608 | 446 | def decSum(n, sm, mn):
#print(n,sm,mn)
if mn + n > 10 :
return 0
elif sum(range(mn, mn + n)) > sm or sum(range(10 - n, 10)) < sm:
return 0
elif n == 1:
return 1
else:
a = 0
for i in range(mn, 10 if sm >= 10 else sm):
a += decSum(n - 1, sm - i, i + ... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,667 |
s947735862 | p00030 | u148101999 | 1459394264 | Python | Python | py | Accepted | 20 | 6408 | 1,184 | #encoding=utf-8
while True:
x, num = map(int,raw_input().split())
if x == num == 0:
break
count = 0
for a in xrange(10):
if num == a and x == 1:
count += 1
if x > 1:
for b in xrange(a + 1,10):
if num == a+b and x == 2:
count += 1
if x > 2:
for c in xrange(b + 1,10):
if num == a+... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,668 |
s082474550 | p00030 | u148101999 | 1459394929 | Python | Python | py | Accepted | 10 | 6428 | 205 | import itertools as iter
while True:
count = 0
x,y = map(int,raw_input().split())
if x == y == 0: break
for element in iter.combinations(range(10),x):
if sum(element) == y:
count += 1
print count | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,669 |
s761879315 | p00030 | u130979865 | 1460136264 | Python | Python | py | Accepted | 10 | 6508 | 257 | # -*- coding: utf-8 -*-
import itertools
while True:
n, s = map(int, raw_input().split())
if n == s == 0:
break
count = 0
for i in itertools.combinations(range(10), n):
if sum(i) == s:
count += 1
print count | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,670 |
s679060067 | p00030 | u572790226 | 1460691689 | Python | Python3 | py | Accepted | 20 | 7576 | 225 | from itertools import combinations
while True:
n, s = map(int, input().split())
if n == s == 0:
break
cnt = 0
for x in combinations(range(10), n):
cnt += 1 if sum(x) == s else 0
print(cnt) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,671 |
s269311468 | p00030 | u597461141 | 1460951336 | Python | Python | py | Accepted | 20 | 6396 | 284 | # -*- coding: utf-8 -*-
import itertools
l = range(0,10)
while True:
cnt = 0
a,b = map(int, raw_input().strip().split())
if a==0 and b==0:
break
for elem in itertools.combinations(l, a):
tmp = 0
for i in xrange(0,a):
tmp += elem[i]
if tmp == b:
cnt += 1
print cnt | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,672 |
s017409219 | p00030 | u894114233 | 1463056719 | Python | Python | py | Accepted | 20 | 6432 | 359 | import sys
sys.setrecursionlimit(10000)
def solve(i,wa,use):
global ct,s,n
if wa==s and use==n:
ct+=1
return
if use>=n or i==10 or wa>s:
return
solve(i+1,wa,use)
solve(i+1,wa+i,use+1)
while 1:
n,s=map(int,raw_input().split())
if n==0 and s==0:
break
ct=0... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,673 |
s997605820 | p00030 | u894114233 | 1463056743 | Python | Python | py | Accepted | 30 | 6360 | 358 | import sys
sys.setrecursionlimit(10000)
def solve(i,wa,use):
global ct,s,n
if wa==s and use==n:
ct+=1
return
if use>n or i==10 or wa>s:
return
solve(i+1,wa,use)
solve(i+1,wa+i,use+1)
while 1:
n,s=map(int,raw_input().split())
if n==0 and s==0:
break
ct=0
... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,674 |
s218149835 | p00030 | u765849500 | 1468235996 | Python | Python | py | Accepted | 10 | 6332 | 184 | import itertools
while True:
n, s = map(int, raw_input().split())
if (n, s) == (0, 0):
break
print [sum(a) for a in itertools.combinations(range(10), n)].count(s) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,675 |
s861783603 | p00030 | u766477342 | 1468639928 | Python | Python3 | py | Accepted | 30 | 7648 | 402 | def f2(cnt, n, ci):
if ci >= 10 or n > 45:
return 0
elif n < ci:
return 0
elif n == ci and cnt > 1:
return 0
elif n == ci and cnt == 1:
return 1
else:
v = f2(cnt - 1, n - ci, ci + 1)
v += f2(cnt, n, ci + 1)
return v
while 1:
n, s = map(in... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,676 |
s477596730 | p00030 | u896025703 | 1469757792 | Python | Python3 | py | Accepted | 40 | 7692 | 190 | import itertools
while True:
n, s = map(int, input().split())
if n == s == 0: break
ans = 0
for l in list(itertools.combinations(range(10), n)):
if sum(l) == s:
ans += 1
print(ans) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,677 |
s571231558 | p00030 | u509278866 | 1470379262 | Python | Python3 | py | Accepted | 70 | 13524 | 299 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time
sys.setrecursionlimit(10**7)
l = list(range(10))
while True:
n,s = list(map(int, input().split()))
if n + s < 1:
break
print(len([a for a in itertools.combinations(l, n) if sum(a) == s])) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,678 |
s628902930 | p00030 | u303753902 | 1470381816 | Python | Python | py | Accepted | 10 | 6424 | 260 | #!/usr/bin/python
import os
import sys
import itertools
while True:
n, s = map(int, raw_input().split())
if n == 0 and s == 0: break
ans = 0
for item in itertools.combinations(range(10), n):
if sum(item) == s: ans += 1
print ans | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,679 |
s377014127 | p00030 | u358919705 | 1471994402 | Python | Python3 | py | Accepted | 30 | 7744 | 174 | import itertools
while True:
n, s = map(int, input().split())
if n == s == 0:
break
print([sum(i) for i in itertools.combinations(range(10), n)].count(s)) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,680 |
s794026694 | p00030 | u379499530 | 1473156681 | Python | Python | py | Accepted | 30 | 6488 | 177 | import itertools
d = xrange(10)
while 1:
n, s = map(int, raw_input().split())
if n == 0: break
x = map(sum, list(itertools.combinations(d, n)))
print x.count(s) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,681 |
s871337770 | p00030 | u922871577 | 1479444142 | Python | Python | py | Accepted | 20 | 6312 | 189 | from itertools import combinations
while True:
n, s = map(int, raw_input().split())
if n == 0 and s == 0:
break
print sum(sum(x)==s for x in combinations(range(10), n)) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,682 |
s113655740 | p00030 | u777299405 | 1480059026 | Python | Python3 | py | Accepted | 20 | 7628 | 180 | import itertools
while True:
n, s = map(int, input().split())
if n == s == 0:
break
print(sum(1 for i in itertools.combinations(range(10), n) if sum(i) == s)) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,683 |
s909920328 | p00030 | u811773570 | 1480380457 | Python | Python3 | py | Accepted | 20 | 7608 | 250 | import itertools
while True:
a, b = map(int, input(). split())
if a == 0 and b == 0:
break
s = list(itertools.combinations(range(10), a))
cnt = 0
for i in s:
if sum(i) == b:
cnt += 1
print(cnt) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,684 |
s453031526 | p00030 | u301729341 | 1481370560 | Python | Python3 | py | Accepted | 30 | 7620 | 375 | import itertools
Num_lis = [0,1,2,3,4,5,6,7,8,9]
while True:
num = 0
n,s = map(int,input().split())
if [n,s] == [0,0]:
break
Con_lis = list(itertools.combinations(Num_lis, n))
for i in range(len(Con_lis)):
Sum = 0
for j in range(n):
Sum += Con_lis[i][j]
... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,685 |
s125391602 | p00030 | u811733736 | 1481690629 | Python | Python3 | py | Accepted | 30 | 7520 | 427 | from itertools import combinations
if __name__ == '__main__':
while True:
# ??????????????\???
n, s = [int(x) for x in input().split(' ')]
if n == 0 and s == 0:
break
# ????????????
answer = 0
combi = combinations(range(0, 10), n)
for c in combi... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,686 |
s064211294 | p00030 | u811733736 | 1481705092 | Python | Python3 | py | Accepted | 50 | 7884 | 1,667 | from collections import deque
class Bt(object):
def __init__(self):
self.used = [False] * 10 # 0-9????????°???????????¨?????????????????????????????°
self.answers = [] # ?????¶???????????????????????????
self.Q = deque() # ????????§???????????¢??????????????°???????¨???¶??¨
def sol... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,687 |
s457601956 | p00030 | u811733736 | 1481705336 | Python | Python3 | py | Accepted | 40 | 7888 | 1,745 | from collections import deque
class Bt(object):
def __init__(self):
self.used = [False] * 10 # 0-9????????°???????????¨?????????????????????????????°
self.answers = [] # ?????¶???????????????????????????
self.Q = deque() # ????????§???????????¢??????????????°???????¨???¶??¨
def sol... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,688 |
s321880393 | p00030 | u661290476 | 1482381989 | Python | Python3 | py | Accepted | 30 | 7512 | 221 | from itertools import combinations
while True:
cnt=0
n,s=map(int,input().split())
if n==0 and s==0:
break
for i in combinations(range(10),n):
if sum(i)==s:
cnt+=1
print(cnt) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,689 |
s420279646 | p00030 | u546285759 | 1483082165 | Python | Python3 | py | Accepted | 30 | 7668 | 171 | from itertools import combinations
while True:
n, s = map(int, input().split())
if n==s==0: break
print([sum(c) for c in combinations(range(10), n)].count(s)) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,690 |
s037663076 | p00030 | u711765449 | 1484659144 | Python | Python3 | py | Accepted | 20 | 7788 | 295 | import itertools
def cal(n,s):
l = list(itertools.combinations(range(10),n))
count = 0
for i in l:
if sum(i) == s:
count += 1
return count
while True:
n,s = map(int,input().split())
if n == 0 and s==0:
break
else:
print(cal(n,s)) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,691 |
s106509723 | p00030 | u078042885 | 1485195941 | Python | Python3 | py | Accepted | 30 | 7668 | 157 | import itertools
while 1:
n,s=map(int, input().split())
if n==0: break
print(len([1 for c in itertools.combinations(range(10), n) if sum(c)==s])) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,692 |
s838759582 | p00030 | u032662562 | 1486814442 | Python | Python3 | py | Accepted | 30 | 7596 | 458 | def solve(n,s,lst):
if n == 0 and s == 0:
#print("Complete!")
return(1)
elif n==0 or len(lst)==0 or s < lst[0]:
return(0)
else:
return(solve(n-1,s-lst[0],lst[1:]) + solve(n,s,lst[1:]))
if __name__ == "__main__":
while True:
n, s = map(int, input().split())
... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,693 |
s983583060 | p00030 | u964040941 | 1489763163 | Python | Python3 | py | Accepted | 60 | 7664 | 220 | def dfs(i,ls):
if i == 10:
return len(ls) == n and sum(ls) == s
return dfs(i + 1,ls) + dfs(i + 1,ls + [i])
while True:
n,s = map(int,input().split())
if n == 0:
break
print(dfs(0,[])) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,694 |
s060410020 | p00030 | u227162786 | 1490003649 | Python | Python3 | py | Accepted | 40 | 7628 | 521 | def dfs(s, l, n):
'''
l?????????????????°??????n???????????§s????????????????????????????????°
'''
if s < 0:
return 0
elif n == 0:
if s == 0:
return 1
else:
return 0
else:
return sum([dfs(s-l[i], l[i+1:], n-1) for i in range(len(l))])
nl, ... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,695 |
s098169963 | p00030 | u901080241 | 1491633955 | Python | Python3 | py | Accepted | 30 | 7520 | 212 | from itertools import combinations
while True:
n,s = map(int, input().split())
if n==0:
break
ctr=0
for cmb in combinations(range(10), n):
if sum(cmb)==s : ctr += 1
print(ctr) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,696 |
s217866738 | p00030 | u462831976 | 1492768726 | Python | Python3 | py | Accepted | 30 | 7964 | 291 | # -*- coding: utf-8 -*-
import sys
import os
import datetime
from itertools import combinations
for s in sys.stdin:
n, s = map(int, s.split())
if n == 0:
break
cnt = 0
for x in combinations(range(10), n):
if sum(x) == s:
cnt += 1
print(cnt) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,697 |
s258596983 | p00030 | u905313459 | 1496476341 | Python | Python3 | py | Accepted | 30 | 7536 | 266 | import sys
from itertools import combinations as c
for line in sys.stdin:
count = 0
k, v = map(int, line.split())
if k or v:
for i in c(range(10), k):
if sum(i) == v:
count += 1
else:
break
print(count) | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,698 |
s319993410 | p00030 | u301729341 | 1497166602 | Python | Python3 | py | Accepted | 50 | 7572 | 344 | a = [0,1,2,3,4,5,6,7,8,9]
wa_lis = []
num = 0
def wa(n,k,m):
global num
if n == 10 and m == 0 and k == 0:
num += 1
if n == 10:
return
return wa(n + 1,k - a[n],m - 1) or wa(n+1,k,m)
while True:
n,s = map(int,input().split())
if [n,s] == [0,0]:
break
wa(0,s,n)
... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,699 |
s394626645 | p00030 | u510797278 | 1504253202 | Python | Python3 | py | Accepted | 50 | 7624 | 498 | s = 0
comb = 0
def main():
global s, comb
while True:
n, s = map(int, input().split())
if n == 0 and s == 0:
break
comb = 0
dfs(0, n, 0)
print(comb)
def dfs(i, num_count, current_sum):
global comb
if num_count == 0 and current_sum == s:
co... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,700 |
s237465042 | p00030 | u957021183 | 1504850120 | Python | Python3 | py | Accepted | 40 | 7764 | 512 | # Aizu Problem 0030: Sum of Integers
#
import sys, math, os
# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
sys.stdin = open("sample-input.txt", "rt")
def dfs(pos, t, sum):
global cnt
if t == n:
if sum == s:
cnt += 1
return
if pos > 9:
return
d... | p00030 |
<H1>整数の和</H1>
<p>
0 から 9 の数字から異なる <var>n</var> 個の数を取り出して合計が <var>s</var> となる組み合わせの数を出力するプログラムを作成してください。<var>n</var> 個の数はおのおの 0 から 9 までとし、1つの組み合わせに同じ数字は使えません。たとえば、<var>n</var> が 3 で <var>s</var> が 6 のとき、3 個の数字の合計が 6 になる組み合わせは、<br/>
<br/>
1 + 2 + 3 = 6<br/>
0 + 1 + 5 = 6<br/>
0 + 2 + 4 = 6<br/>
<br/>
の 3 通りとなります。
</p... | 3 6
3 1
0 0
| 3
0
| 8,701 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.