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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s595559138 | p02212 | u464046224 | 1592560137 | Python | Python3 | py | Accepted | 60 | 7104 | 835 | import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase... | p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,880 |
s092102216 | p02212 | u842461513 | 1588999814 | Python | Python3 | py | Accepted | 20 | 5592 | 375 | num_list = sorted(list(map(int,input().split()))) #標準入力をして小さい順にしリストに入れる
num1 = num_list[0] + num_list[3] #リストの1番大きい数と1番小さい数を足す
num2 = num_list[1] + num_list[2] #リストの2番目と三番目を足す
print(max(num1,num2) - min(num1,num2)) #2つの数の大きい方から小さい方を引く
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,881 |
s975759863 | p02212 | u503217379 | 1586879562 | Python | Python | py | Accepted | 10 | 4624 | 73 | a=map(int,raw_input().split())
a.sort()
print abs(a[0]+a[3]-a[1]-a[2])
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,882 |
s067446234 | p02212 | u466254538 | 1584683706 | Python | Python3 | py | Accepted | 20 | 5596 | 102 | a, b, c, d = map(int,input().split())
print(min(abs((a+b)-(c+d)),abs((a+c)-(b+d)),abs((a+d)-(c+b))))
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,883 |
s711166312 | p02212 | u967927776 | 1584681269 | Python | Python3 | py | Accepted | 20 | 5608 | 177 | #!/usr/bin/env python3
import sys
input = sys.stdin.readline
power = [int(item) for item in input().split()]
power.sort()
print(abs(power[0] + power[3] - power[1] - power[2]))
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,884 |
s438440685 | p02212 | u506554532 | 1584681120 | Python | Python3 | py | Accepted | 20 | 5600 | 125 | a,b,c,d = map(int,input().split())
def f(x,y):
return abs(x-y)
ans = min(f(a+b,c+d), f(a+c,b+d), f(a+d,b+c))
print(ans)
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,885 |
s730289929 | p02212 | u821608651 | 1584680081 | Python | Python3 | py | Accepted | 30 | 6028 | 513 | from heapq import *
from collections import deque
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
de... | p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,886 |
s524913359 | p02212 | u926915999 | 1584679510 | Python | Python3 | py | Accepted | 20 | 5588 | 77 | A = sorted(list(map(int, input().split())))
print(abs(A[0]+A[3]-A[1]-A[2]))
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,887 |
s345783411 | p02212 | u927793658 | 1584678999 | Python | Python3 | py | Accepted | 20 | 5600 | 481 | def main():
A= list(map( int, input().split()))
ans = abs(A[0]+A[1]-A[2]-A[3])
for i in range(4):
for j in range(4):
if i == j:
continue
now = 0
for t in range(4):
if t == i or t == j:
now += A[t]
... | p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,888 |
s189118356 | p02212 | u873268966 | 1584677303 | Python | Python3 | py | Accepted | 20 | 5608 | 93 | a = list(map(int,input().split()))
print(min(abs(sum(a)-(a[0]+a[i])*2) for i in range(1,4)))
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,889 |
s609218069 | p02212 | u384017042 | 1584677273 | Python | Python3 | py | Accepted | 20 | 5588 | 77 | A = sorted(list(map(int, input().split())))
print(abs(A[3]+A[0]-A[1]-A[2]))
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,890 |
s662426532 | p02212 | u589808262 | 1584677237 | Python | Python3 | py | Accepted | 30 | 6068 | 964 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for ... | p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,891 |
s413941126 | p02212 | u979148405 | 1584677115 | Python | Python3 | py | Accepted | 20 | 5616 | 108 | a,b,c,d=map(int,input().split())
ans=1e100
for x in (b,c,d):
ans=min(ans,abs(a+x*2-(b+c+d)))
print(ans)
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,892 |
s864183562 | p02212 | u813784958 | 1584677046 | Python | Python3 | py | Accepted | 20 | 5596 | 209 | l = list(map(int, input().split()))
ans = tot = sum(l)
for i in range(3):
for j in range(i+1,4):
cur = l[i] + l[j]
c = abs(tot - cur * 2)
if ans > c:
ans = c
print(ans)
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,893 |
s326639434 | p02212 | u740238212 | 1584677045 | Python | Python3 | py | Accepted | 20 | 5596 | 123 | a, b, c, d = map(int, input().split())
x = [a+b-c-d, a+c-b-d, a+d-b-c, b+c-a-d, b+d-a-c, c+d-a-b]
print(min(map(abs, x)))
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,894 |
s792451368 | p02212 | u613396167 | 1584676990 | Python | Python3 | py | Accepted | 20 | 5596 | 351 | li = list(map(int, input().split()))
ans = 10 ** 9
for bit_state in range(1 << 4):
if bin(bit_state).count("1") == 2:
tmp1 = 0
tmp2 = 0
for i in range(4):
if bit_state & (1 << i):
tmp1 += li[i]
else:
tmp2 += li[i]
ans = min(ans... | p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,895 |
s741518230 | p02212 | u172639992 | 1584676981 | Python | Python3 | py | Accepted | 20 | 5588 | 99 | a,b,c,d = map(int,input().split())
tuyoi = max(a,b,c,d) + min(a,c,b,d)
print(abs(a+b+c+d-2*tuyoi))
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,896 |
s572753625 | p02212 | u530906291 | 1584676975 | Python | Python3 | py | Accepted | 20 | 5588 | 79 | A=list(map(int,input().split()))
x=min(A)+max(A)
y=sum(A)-x
print(abs(x-y))
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,897 |
s390251772 | p02212 | u981149482 | 1584676946 | Python | Python3 | py | Accepted | 30 | 6036 | 368 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque, Counter
def getN():
return int(input())
def getList():
return list(map(int, input().split()))
import math
def main():
a,b,c,d = getList()
ans = min([abs(a+b-c-d), abs(a+c-b-d), abs(a+d-b-c)]
)
p... | p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,898 |
s430070290 | p02212 | u555923664 | 1584676932 | Python | Python3 | py | Accepted | 20 | 5588 | 76 | a = list(map(int,input().split()))
a.sort()
print(abs(a[0]+a[3]-a[2]-a[1]))
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,899 |
s666112828 | p02212 | u884144007 | 1584676932 | Python | Python3 | py | Accepted | 20 | 5620 | 341 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import itertools
A = list(map(int,read().split()))
S = sum(A)
answer = 10 ** 10
for a,b in itertools.combinations(A,2):
S1 = a + b
S2 = S - S1
x = abs(S1 - S2)
if answer > x:
answ... | p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,900 |
s515597069 | p02212 | u611853667 | 1584676925 | Python | Python3 | py | Accepted | 20 | 5600 | 157 | a,b,c,d = map(int, input().split())
ans = 1<<30
def go(x, y):
global ans
ans = min(ans, abs(x-y))
go(a+b,c+d)
go(a+c,b+d)
go(a+d,b+c)
print(ans)
| p02212 | <span class="lang">
<span class="lang-ja">
<h1>A: チーム分け</h1>
<div class="part">
<section>
<h3>問題文</h3><p>今年の KUPC はチームで参加できることを聞きつけたあなたは、友達に声をかけてチームで出場することにしました。</p>
<p>最終的に、あなたを含めて $4$ 人が集まりました。</p>
<p>個人の強さはレーティングで表され、$4$ 人のレーティングはそれぞれ $a$, $b$, $c$, $d$ です。</p>
<p>あなたたちは $2$ 人ずつの $2$ チームに分かれることにしました。</p>
<p>このとき、チー... | 2 1 3 4
| 0
| 27,901 |
s501447513 | p02213 | u967927776 | 1584688397 | Python | Python3 | py | Accepted | 60 | 15592 | 6,020 | #!/usr/bin/env python3
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
from collections import deque
h, w = map(int, input().split())
edge = [[] for _ in range(8 * w * h)]
field = []
for _ in range(h):
line = input().rstrip()
field.append(line)
if field[h-1][w-1] == "#":
print("NO")
... | p02213 | <span class="lang">
<span class="lang-ja">
<h1>B: サイコロを転がさないで</h1>
<div class="part">
<section>
<h3>問題文</h3><p>$H$ 行 $W$ 列からなるグリッドがあります。以降、グリッド上の $i$ 行目 $j$ 列目のマスを $(i, j)$ のマスと書きます。</p>
<p>グリッドの各マスには、$1$ 以上 $6$ 以下の数字か、あるいは <code>#</code> の文字が $1$ つずつ書かれています。<span style="font-weight: bold;">ただし、$i$ と $j$ がともに偶数であるような ... | 3 3
631
4#2
516
| YES
| 27,902 |
s789404948 | p02213 | u506554532 | 1584685259 | Python | Python3 | py | Accepted | 60 | 5948 | 1,106 | H,W = map(int,input().split())
S = [input() for i in range(H)]
def tor(x,y):
to = {'6':'3','3':'1','1':'4','4':'6'} if y%4==0 else {'6':'4','4':'1','1':'3','3':'6'}
return to[S[y][x]]
def tol(x,y):
to = {'6':'3','3':'1','1':'4','4':'6'} if y%4==2 else {'6':'4','4':'1','1':'3','3':'6'}
return to[S[y][x]... | p02213 | <span class="lang">
<span class="lang-ja">
<h1>B: サイコロを転がさないで</h1>
<div class="part">
<section>
<h3>問題文</h3><p>$H$ 行 $W$ 列からなるグリッドがあります。以降、グリッド上の $i$ 行目 $j$ 列目のマスを $(i, j)$ のマスと書きます。</p>
<p>グリッドの各マスには、$1$ 以上 $6$ 以下の数字か、あるいは <code>#</code> の文字が $1$ つずつ書かれています。<span style="font-weight: bold;">ただし、$i$ と $j$ がともに偶数であるような ... | 3 3
631
4#2
516
| YES
| 27,903 |
s648851913 | p02213 | u384017042 | 1584684428 | Python | Python3 | py | Accepted | 50 | 10676 | 1,175 | import sys
sys.setrecursionlimit(10**6)
H, W = map(int, input().split())
S = [[c for c in input()] for _ in range(H)]
B = [[False] * W for _ in range(H)]
R = [['6', '3', '1', '4'], ['1', '3', '6', '4']]
C = [['6', '2', '1', '5'], ['1', '2', '6', '5']]
G = [['6', '3', '1', '4'], ['2', '-1', '2', '-1'],
['1', '3', ... | p02213 | <span class="lang">
<span class="lang-ja">
<h1>B: サイコロを転がさないで</h1>
<div class="part">
<section>
<h3>問題文</h3><p>$H$ 行 $W$ 列からなるグリッドがあります。以降、グリッド上の $i$ 行目 $j$ 列目のマスを $(i, j)$ のマスと書きます。</p>
<p>グリッドの各マスには、$1$ 以上 $6$ 以下の数字か、あるいは <code>#</code> の文字が $1$ つずつ書かれています。<span style="font-weight: bold;">ただし、$i$ と $j$ がともに偶数であるような ... | 3 3
631
4#2
516
| YES
| 27,904 |
s530369878 | p02213 | u555923664 | 1584683961 | Python | Python3 | py | Accepted | 60 | 7760 | 588 | H,W = map(int,input().split())
S = [list(input()) for i in range(H)]
A = [[False]*W for i in range(H)]
Q = [(0,0,(5,4,1,3,6,2))]
while Q:
q = Q.pop()
h,w,s = q[0],q[1],q[2]
if min(h,w)<0 or h>=H or w>=W:continue
if S[h][w]=="#":continue
if A[h][w]:continue
if int(S[h][w])!=s[4]:continue
A... | p02213 | <span class="lang">
<span class="lang-ja">
<h1>B: サイコロを転がさないで</h1>
<div class="part">
<section>
<h3>問題文</h3><p>$H$ 行 $W$ 列からなるグリッドがあります。以降、グリッド上の $i$ 行目 $j$ 列目のマスを $(i, j)$ のマスと書きます。</p>
<p>グリッドの各マスには、$1$ 以上 $6$ 以下の数字か、あるいは <code>#</code> の文字が $1$ つずつ書かれています。<span style="font-weight: bold;">ただし、$i$ と $j$ がともに偶数であるような ... | 3 3
631
4#2
516
| YES
| 27,905 |
s126512846 | p02213 | u821608651 | 1584682565 | Python | Python3 | py | Accepted | 80 | 9508 | 2,539 | from heapq import *
from collections import deque
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
de... | p02213 | <span class="lang">
<span class="lang-ja">
<h1>B: サイコロを転がさないで</h1>
<div class="part">
<section>
<h3>問題文</h3><p>$H$ 行 $W$ 列からなるグリッドがあります。以降、グリッド上の $i$ 行目 $j$ 列目のマスを $(i, j)$ のマスと書きます。</p>
<p>グリッドの各マスには、$1$ 以上 $6$ 以下の数字か、あるいは <code>#</code> の文字が $1$ つずつ書かれています。<span style="font-weight: bold;">ただし、$i$ と $j$ がともに偶数であるような ... | 3 3
631
4#2
516
| YES
| 27,906 |
s875731313 | p02213 | u927793658 | 1584680328 | Python | Python3 | py | Accepted | 20 | 5988 | 1,117 | def main():
H, W = map( int, input().split())
S = [ list( input()) for _ in range(H)]
T = [[6,3,1,4], [2,0,2,0],[1,3,6,4],[5,0,5,0]]
C = [[0]*W for _ in range(H)]
for i in range(H):
for j in range(W):
if S[i][j] == '#':
continue
if T[i%4][j%4] == int(S... | p02213 | <span class="lang">
<span class="lang-ja">
<h1>B: サイコロを転がさないで</h1>
<div class="part">
<section>
<h3>問題文</h3><p>$H$ 行 $W$ 列からなるグリッドがあります。以降、グリッド上の $i$ 行目 $j$ 列目のマスを $(i, j)$ のマスと書きます。</p>
<p>グリッドの各マスには、$1$ 以上 $6$ 以下の数字か、あるいは <code>#</code> の文字が $1$ つずつ書かれています。<span style="font-weight: bold;">ただし、$i$ と $j$ がともに偶数であるような ... | 3 3
631
4#2
516
| YES
| 27,907 |
s181914244 | p02213 | u873268966 | 1584680003 | Python | Python3 | py | Accepted | 50 | 12800 | 558 | import sys
sys.setrecursionlimit(10**7)
dice = [[6,3,1,4],
[2,0,2,0],
[1,3,6,4],
[5,0,5,0]]
H,W = map(int,input().split())
s = list(input() for _ in range(H))
board = [[0]*W for _ in range(H)]
def dfs(x,y):
board[x][y] = 1
for dx,dy in [[0,-1],[0,1],[1,0],[-1,0]]:
if not(0 <= d... | p02213 | <span class="lang">
<span class="lang-ja">
<h1>B: サイコロを転がさないで</h1>
<div class="part">
<section>
<h3>問題文</h3><p>$H$ 行 $W$ 列からなるグリッドがあります。以降、グリッド上の $i$ 行目 $j$ 列目のマスを $(i, j)$ のマスと書きます。</p>
<p>グリッドの各マスには、$1$ 以上 $6$ 以下の数字か、あるいは <code>#</code> の文字が $1$ つずつ書かれています。<span style="font-weight: bold;">ただし、$i$ と $j$ がともに偶数であるような ... | 3 3
631
4#2
516
| YES
| 27,908 |
s743170903 | p02213 | u813784958 | 1584678977 | Python | Python3 | py | Accepted | 70 | 6620 | 809 | from collections import deque
h,w = map(int,input().split())
g = [list(map(int, list(input().replace('#', '0')))) for _ in range(h)]
f = [[False]*w for _ in range(h)]
q = deque()
d = ((0,1), (1,0), (-1,0), (0,-1))
def chst(c,st,i):
if i == 1:
nc = st[1]
nst = (st[0], 7-c)
if i == 0:
nc = st[0]
nst... | p02213 | <span class="lang">
<span class="lang-ja">
<h1>B: サイコロを転がさないで</h1>
<div class="part">
<section>
<h3>問題文</h3><p>$H$ 行 $W$ 列からなるグリッドがあります。以降、グリッド上の $i$ 行目 $j$ 列目のマスを $(i, j)$ のマスと書きます。</p>
<p>グリッドの各マスには、$1$ 以上 $6$ 以下の数字か、あるいは <code>#</code> の文字が $1$ つずつ書かれています。<span style="font-weight: bold;">ただし、$i$ と $j$ がともに偶数であるような ... | 3 3
631
4#2
516
| YES
| 27,909 |
s226370184 | p02213 | u740238212 | 1584678801 | Python | Python3 | py | Accepted | 40 | 11760 | 1,108 | import sys
sys.setrecursionlimit(pow(10, 8))
S = [6, 3, 1, 4, 2, 5]
H, W = map(int, input().split())
X = []
for i in range(H):
X.append(input().strip())
def migi(S):
return [S[1], S[2], S[3], S[0], S[4], S[5]]
def hidari(S):
return [S[3], S[0], S[1], S[2], S[4], S[5]]
def sita(S):
return [S[4], S[1], ... | p02213 | <span class="lang">
<span class="lang-ja">
<h1>B: サイコロを転がさないで</h1>
<div class="part">
<section>
<h3>問題文</h3><p>$H$ 行 $W$ 列からなるグリッドがあります。以降、グリッド上の $i$ 行目 $j$ 列目のマスを $(i, j)$ のマスと書きます。</p>
<p>グリッドの各マスには、$1$ 以上 $6$ 以下の数字か、あるいは <code>#</code> の文字が $1$ つずつ書かれています。<span style="font-weight: bold;">ただし、$i$ と $j$ がともに偶数であるような ... | 3 3
631
4#2
516
| YES
| 27,910 |
s346063738 | p02213 | u589808262 | 1584678139 | Python | Python3 | py | Accepted | 60 | 6184 | 1,685 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for ... | p02213 | <span class="lang">
<span class="lang-ja">
<h1>B: サイコロを転がさないで</h1>
<div class="part">
<section>
<h3>問題文</h3><p>$H$ 行 $W$ 列からなるグリッドがあります。以降、グリッド上の $i$ 行目 $j$ 列目のマスを $(i, j)$ のマスと書きます。</p>
<p>グリッドの各マスには、$1$ 以上 $6$ 以下の数字か、あるいは <code>#</code> の文字が $1$ つずつ書かれています。<span style="font-weight: bold;">ただし、$i$ と $j$ がともに偶数であるような ... | 3 3
631
4#2
516
| YES
| 27,911 |
s763109023 | p02213 | u981149482 | 1584678030 | Python | Python3 | py | Accepted | 60 | 7108 | 959 | import sys
readline = sys.stdin.readline
H, W = map(int, readline().split())
Gr = [list(map(lambda x: int(x) if x != '#' else 7, readline().strip())) for _ in range(H)]
Ri = []
for h in range(H):
if h % 4 == 0:
Ri.append([6, 3, 1, 4]*W)
elif h % 4 == 1:
Ri.append([2, 8, 2, 8]*W)
elif h % ... | p02213 | <span class="lang">
<span class="lang-ja">
<h1>B: サイコロを転がさないで</h1>
<div class="part">
<section>
<h3>問題文</h3><p>$H$ 行 $W$ 列からなるグリッドがあります。以降、グリッド上の $i$ 行目 $j$ 列目のマスを $(i, j)$ のマスと書きます。</p>
<p>グリッドの各マスには、$1$ 以上 $6$ 以下の数字か、あるいは <code>#</code> の文字が $1$ つずつ書かれています。<span style="font-weight: bold;">ただし、$i$ と $j$ がともに偶数であるような ... | 3 3
631
4#2
516
| YES
| 27,912 |
s551755762 | p02213 | u530906291 | 1584677726 | Python | Python3 | py | Accepted | 40 | 5868 | 1,983 | H,W=map(int,input().split())
MAP=[input() for i in range(H)]
CANGO=[[0]*W for i in range(H)]
CANGO[0][0]=1
Q=[(0,0)]
while Q:
x,y=Q.pop()
for tox,toy in [[x+1,y],[x-1,y],[x,y+1],[x,y-1]]:
if 0<=tox<H and 0<=toy<W and CANGO[tox][toy]==0:
if tox%4==0:
if toy%4==0 and MAP[to... | p02213 | <span class="lang">
<span class="lang-ja">
<h1>B: サイコロを転がさないで</h1>
<div class="part">
<section>
<h3>問題文</h3><p>$H$ 行 $W$ 列からなるグリッドがあります。以降、グリッド上の $i$ 行目 $j$ 列目のマスを $(i, j)$ のマスと書きます。</p>
<p>グリッドの各マスには、$1$ 以上 $6$ 以下の数字か、あるいは <code>#</code> の文字が $1$ つずつ書かれています。<span style="font-weight: bold;">ただし、$i$ と $j$ がともに偶数であるような ... | 3 3
631
4#2
516
| YES
| 27,913 |
s673312682 | p02213 | u611853667 | 1584677721 | Python | Python3 | py | Accepted | 60 | 6052 | 1,146 | h, w = map(int, input().split())
p = list(range(h*w))
def find(x):
global p
if p[x] == x:return x
p[x] = find(p[x])
return p[x]
def unite(x, y):
global p
x = find(x)
y = find(y)
if x != y:p[x] =y
def real_number(i, j):
i += 1
j += 1
i %= 4
j %= 4
if i == 1 and j =... | p02213 | <span class="lang">
<span class="lang-ja">
<h1>B: サイコロを転がさないで</h1>
<div class="part">
<section>
<h3>問題文</h3><p>$H$ 行 $W$ 列からなるグリッドがあります。以降、グリッド上の $i$ 行目 $j$ 列目のマスを $(i, j)$ のマスと書きます。</p>
<p>グリッドの各マスには、$1$ 以上 $6$ 以下の数字か、あるいは <code>#</code> の文字が $1$ つずつ書かれています。<span style="font-weight: bold;">ただし、$i$ と $j$ がともに偶数であるような ... | 3 3
631
4#2
516
| YES
| 27,914 |
s421982815 | p02216 | u589808262 | 1584788300 | Python | Python3 | py | Accepted | 100 | 29716 | 887 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for ... | p02216 | <span class="lang">
<span class="lang-ja">
<h1>E: 数列ゲーム</h1>
<div class="part">
<section>
<h3>問題文</h3><p>長さ $N$ の正整数列 $a_1, a_2, \ldots, a_N$ があります。</p>
<p>この数列を用いた、$2$ 人のプレイヤーが先手と後手に分かれて行う以下のゲームを考えます。</p>
<ul>
<li>先手と後手は交互に、以下の操作のどちらかを選んで行う。<ul>
<li>数列の正の項を $1$ つ選び、その値を $1$ 減らす。</li>
<li>数列の全ての項が正のとき、全ての項の値を $1$ ずつ減ら... | 2
1 2
| First
| 27,915 |
s851180927 | p02216 | u506554532 | 1584689635 | Python | Python3 | py | Accepted | 80 | 28344 | 210 | N = int(input())
A = list(map(int,input().split()))
if N%2 or 0 in A:
print('First' if sum(A)%2 else 'Second')
exit()
if min(A)%2:
print('First')
else:
print('First' if sum(A)%2 else 'Second')
| p02216 | <span class="lang">
<span class="lang-ja">
<h1>E: 数列ゲーム</h1>
<div class="part">
<section>
<h3>問題文</h3><p>長さ $N$ の正整数列 $a_1, a_2, \ldots, a_N$ があります。</p>
<p>この数列を用いた、$2$ 人のプレイヤーが先手と後手に分かれて行う以下のゲームを考えます。</p>
<ul>
<li>先手と後手は交互に、以下の操作のどちらかを選んで行う。<ul>
<li>数列の正の項を $1$ つ選び、その値を $1$ 減らす。</li>
<li>数列の全ての項が正のとき、全ての項の値を $1$ ずつ減ら... | 2
1 2
| First
| 27,916 |
s949724727 | p02216 | u965725118 | 1584686113 | Python | Python3 | py | Accepted | 100 | 32432 | 1,737 | #
# ⋀_⋀
# (・ω・)
# ./ U ∽ U\
# │* 合 *│
# │* 格 *│
# │* 祈 *│
# │* 願 *│
# │* *│
#  ̄
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないyp
from heapq import heappop, heappush, heappushpop
from collections import Counter,default... | p02216 | <span class="lang">
<span class="lang-ja">
<h1>E: 数列ゲーム</h1>
<div class="part">
<section>
<h3>問題文</h3><p>長さ $N$ の正整数列 $a_1, a_2, \ldots, a_N$ があります。</p>
<p>この数列を用いた、$2$ 人のプレイヤーが先手と後手に分かれて行う以下のゲームを考えます。</p>
<ul>
<li>先手と後手は交互に、以下の操作のどちらかを選んで行う。<ul>
<li>数列の正の項を $1$ つ選び、その値を $1$ 減らす。</li>
<li>数列の全ての項が正のとき、全ての項の値を $1$ ずつ減ら... | 2
1 2
| First
| 27,917 |
s580624569 | p02216 | u530906291 | 1584685399 | Python | Python3 | py | Accepted | 80 | 28344 | 289 | N=int(input())
A=list(map(int,input().split()))
if N%2==1:
if sum(A)%2==1:
print("First")
else:
print("Second")
else:
if min(A)%2==1:
print("First")
else:
if sum(A)%2==0:
print("Second")
else:
print("First")
| p02216 | <span class="lang">
<span class="lang-ja">
<h1>E: 数列ゲーム</h1>
<div class="part">
<section>
<h3>問題文</h3><p>長さ $N$ の正整数列 $a_1, a_2, \ldots, a_N$ があります。</p>
<p>この数列を用いた、$2$ 人のプレイヤーが先手と後手に分かれて行う以下のゲームを考えます。</p>
<ul>
<li>先手と後手は交互に、以下の操作のどちらかを選んで行う。<ul>
<li>数列の正の項を $1$ つ選び、その値を $1$ 減らす。</li>
<li>数列の全ての項が正のとき、全ての項の値を $1$ ずつ減ら... | 2
1 2
| First
| 27,918 |
s542602812 | p02216 | u873268966 | 1584684905 | Python | Python3 | py | Accepted | 90 | 28360 | 295 | def solve(N,a):
if N%2 == 1:
return ["Second","First"][sum(a)%2]
else:
if min(a)%2 == 1:
return "First"
return ["Second","First"][sum(a)%2]
if __name__ == "__main__":
N = int(input())
a = list(map(int,input().split()))
print(solve(N,a))
| p02216 | <span class="lang">
<span class="lang-ja">
<h1>E: 数列ゲーム</h1>
<div class="part">
<section>
<h3>問題文</h3><p>長さ $N$ の正整数列 $a_1, a_2, \ldots, a_N$ があります。</p>
<p>この数列を用いた、$2$ 人のプレイヤーが先手と後手に分かれて行う以下のゲームを考えます。</p>
<ul>
<li>先手と後手は交互に、以下の操作のどちらかを選んで行う。<ul>
<li>数列の正の項を $1$ つ選び、その値を $1$ 減らす。</li>
<li>数列の全ての項が正のとき、全ての項の値を $1$ ずつ減ら... | 2
1 2
| First
| 27,919 |
s323464108 | p02216 | u740238212 | 1584680225 | Python | Python3 | py | Accepted | 90 | 28344 | 267 | N = int(input())
X = list(map(int, input().split()))
S = sum(X)
M = min(X)
if N % 2:
if S%2:
print("First")
else:
print("Second")
else:
if S%2:
print("First")
elif M%2:
print("First")
else:
print("Second")
| p02216 | <span class="lang">
<span class="lang-ja">
<h1>E: 数列ゲーム</h1>
<div class="part">
<section>
<h3>問題文</h3><p>長さ $N$ の正整数列 $a_1, a_2, \ldots, a_N$ があります。</p>
<p>この数列を用いた、$2$ 人のプレイヤーが先手と後手に分かれて行う以下のゲームを考えます。</p>
<ul>
<li>先手と後手は交互に、以下の操作のどちらかを選んで行う。<ul>
<li>数列の正の項を $1$ つ選び、その値を $1$ 減らす。</li>
<li>数列の全ての項が正のとき、全ての項の値を $1$ ずつ減ら... | 2
1 2
| First
| 27,920 |
s380983143 | p02216 | u611853667 | 1584678507 | Python | Python3 | py | Accepted | 90 | 28352 | 361 | n = int(input())
a = list(map(int, input().split()))
min_a = min(a)
sum_a = sum(a)
rest = sum_a - n * min_a
def first():
print("First")
exit()
def second():
print("Second")
exit()
if n % 2 == 1:
if sum_a % 2 == 0:second()
if sum_a % 2 == 1:first()
if min_a % 2 == 1:first()
if rest % 2 == ... | p02216 | <span class="lang">
<span class="lang-ja">
<h1>E: 数列ゲーム</h1>
<div class="part">
<section>
<h3>問題文</h3><p>長さ $N$ の正整数列 $a_1, a_2, \ldots, a_N$ があります。</p>
<p>この数列を用いた、$2$ 人のプレイヤーが先手と後手に分かれて行う以下のゲームを考えます。</p>
<ul>
<li>先手と後手は交互に、以下の操作のどちらかを選んで行う。<ul>
<li>数列の正の項を $1$ つ選び、その値を $1$ 減らす。</li>
<li>数列の全ての項が正のとき、全ての項の値を $1$ ずつ減ら... | 2
1 2
| First
| 27,921 |
s547949545 | p02223 | u503217379 | 1586881901 | Python | Python | py | Accepted | 10 | 4632 | 128 | n=input()
if n==1:
print "1\n0"
elif n==2:
print "2\n0\n11"
else:
print n-1
for i in xrange(n-1):
print "1"+("0"*i)+"1"
| p02223 | <span class="lang">
<span class="lang-ja">
<h1>M: 文字列集合</h1>
<div class="part">
<section>
<h3>問題文</h3><p>以下の条件を満たす文字列集合 $S$ のうち、要素数が最大となるものを $1$ つ構成してください。</p>
<ul>
<li>$S$ に含まれる文字列の長さは $1$ 以上 $N$ 以下である。</li>
<li>$S$ に含まれる文字列の長さはそれぞれ異なる。</li>
<li>$S$ に含まれる文字列は、文字 <code>0</code>, <code>1</code> のみからなる。</li>
<li>$S$ に含ま... | 2
| 2
0
11
| 27,922 |
s340747771 | p02223 | u480920780 | 1584953978 | Python | Python3 | py | Accepted | 20 | 5616 | 188 | n = int(input())
if n == 1:
print(1)
print(0)
elif n == 2:
print(2)
print(0)
print(11)
else:
print(n-1)
for i in range(n-1):
print("1" + "0" * i + "1")
| p02223 | <span class="lang">
<span class="lang-ja">
<h1>M: 文字列集合</h1>
<div class="part">
<section>
<h3>問題文</h3><p>以下の条件を満たす文字列集合 $S$ のうち、要素数が最大となるものを $1$ つ構成してください。</p>
<ul>
<li>$S$ に含まれる文字列の長さは $1$ 以上 $N$ 以下である。</li>
<li>$S$ に含まれる文字列の長さはそれぞれ異なる。</li>
<li>$S$ に含まれる文字列は、文字 <code>0</code>, <code>1</code> のみからなる。</li>
<li>$S$ に含ま... | 2
| 2
0
11
| 27,923 |
s863632904 | p02223 | u873268966 | 1584688548 | Python | Python3 | py | Accepted | 20 | 5616 | 189 | N = int(input())
K = N-1
if N == 2:
print(2)
print("00")
print("1")
if N == 1:
print(1)
print(1)
else:
print(K)
for i in range(K):
print("1"+"0"*i+"1")
| p02223 | <span class="lang">
<span class="lang-ja">
<h1>M: 文字列集合</h1>
<div class="part">
<section>
<h3>問題文</h3><p>以下の条件を満たす文字列集合 $S$ のうち、要素数が最大となるものを $1$ つ構成してください。</p>
<ul>
<li>$S$ に含まれる文字列の長さは $1$ 以上 $N$ 以下である。</li>
<li>$S$ に含まれる文字列の長さはそれぞれ異なる。</li>
<li>$S$ に含まれる文字列は、文字 <code>0</code>, <code>1</code> のみからなる。</li>
<li>$S$ に含ま... | 2
| 2
0
11
| 27,924 |
s201577771 | p02223 | u813784958 | 1584688226 | Python | Python3 | py | Accepted | 30 | 5628 | 186 | n = int(input())
if n < 3:
c = [0,[0],[0,11]][n]
else:
c = list()
for i in range(n-1):
f = '1' + '0'*i + '1'
c.append(f)
print(len(c))
print(*c, sep = '\n')
| p02223 | <span class="lang">
<span class="lang-ja">
<h1>M: 文字列集合</h1>
<div class="part">
<section>
<h3>問題文</h3><p>以下の条件を満たす文字列集合 $S$ のうち、要素数が最大となるものを $1$ つ構成してください。</p>
<ul>
<li>$S$ に含まれる文字列の長さは $1$ 以上 $N$ 以下である。</li>
<li>$S$ に含まれる文字列の長さはそれぞれ異なる。</li>
<li>$S$ に含まれる文字列は、文字 <code>0</code>, <code>1</code> のみからなる。</li>
<li>$S$ に含ま... | 2
| 2
0
11
| 27,925 |
s013782465 | p02223 | u555923664 | 1584686076 | Python | Python3 | py | Accepted | 30 | 5620 | 159 | N = int(input())
A = []
for i in range(0,N-1):
A.append("1"+"0"*i+"1")
if N==1:
A=["1"]
if N==2:
A=["0","11"]
print(len(A))
for a in A:print(a)
| p02223 | <span class="lang">
<span class="lang-ja">
<h1>M: 文字列集合</h1>
<div class="part">
<section>
<h3>問題文</h3><p>以下の条件を満たす文字列集合 $S$ のうち、要素数が最大となるものを $1$ つ構成してください。</p>
<ul>
<li>$S$ に含まれる文字列の長さは $1$ 以上 $N$ 以下である。</li>
<li>$S$ に含まれる文字列の長さはそれぞれ異なる。</li>
<li>$S$ に含まれる文字列は、文字 <code>0</code>, <code>1</code> のみからなる。</li>
<li>$S$ に含ま... | 2
| 2
0
11
| 27,926 |
s311086155 | p02223 | u506554532 | 1584686062 | Python | Python3 | py | Accepted | 30 | 5616 | 182 | N = int(input())
if N==1:
print(1)
print(0)
elif N==2:
print(2)
print(0)
print(11)
else:
print(N-1)
for i in range(N-1):
print('0' + '1'*i + '0')
| p02223 | <span class="lang">
<span class="lang-ja">
<h1>M: 文字列集合</h1>
<div class="part">
<section>
<h3>問題文</h3><p>以下の条件を満たす文字列集合 $S$ のうち、要素数が最大となるものを $1$ つ構成してください。</p>
<ul>
<li>$S$ に含まれる文字列の長さは $1$ 以上 $N$ 以下である。</li>
<li>$S$ に含まれる文字列の長さはそれぞれ異なる。</li>
<li>$S$ に含まれる文字列は、文字 <code>0</code>, <code>1</code> のみからなる。</li>
<li>$S$ に含ま... | 2
| 2
0
11
| 27,927 |
s757740819 | p02223 | u821608651 | 1584685460 | Python | Python3 | py | Accepted | 30 | 6040 | 1,549 | from heapq import *
from collections import deque
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
de... | p02223 | <span class="lang">
<span class="lang-ja">
<h1>M: 文字列集合</h1>
<div class="part">
<section>
<h3>問題文</h3><p>以下の条件を満たす文字列集合 $S$ のうち、要素数が最大となるものを $1$ つ構成してください。</p>
<ul>
<li>$S$ に含まれる文字列の長さは $1$ 以上 $N$ 以下である。</li>
<li>$S$ に含まれる文字列の長さはそれぞれ異なる。</li>
<li>$S$ に含まれる文字列は、文字 <code>0</code>, <code>1</code> のみからなる。</li>
<li>$S$ に含ま... | 2
| 2
0
11
| 27,928 |
s003133414 | p02223 | u981149482 | 1584685201 | Python | Python3 | py | Accepted | 30 | 6048 | 552 | import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
from collections import deque, Counter
def getN():
return int(input())
def getList():
return list(map(int, input().split()))
import math
INF = 10 ** 20
def main():
n = getN()
if n == 1:
print(1)
print(1)
retu... | p02223 | <span class="lang">
<span class="lang-ja">
<h1>M: 文字列集合</h1>
<div class="part">
<section>
<h3>問題文</h3><p>以下の条件を満たす文字列集合 $S$ のうち、要素数が最大となるものを $1$ つ構成してください。</p>
<ul>
<li>$S$ に含まれる文字列の長さは $1$ 以上 $N$ 以下である。</li>
<li>$S$ に含まれる文字列の長さはそれぞれ異なる。</li>
<li>$S$ に含まれる文字列は、文字 <code>0</code>, <code>1</code> のみからなる。</li>
<li>$S$ に含ま... | 2
| 2
0
11
| 27,929 |
s145082450 | p02223 | u530906291 | 1584681178 | Python | Python3 | py | Accepted | 20 | 5616 | 176 | N=int(input())
if N==1:
print(1)
print(0)
elif N==2:
print(2)
print(11)
print(0)
else:
print(N-1)
for i in range(N-1):
print("0"+"1"*i+"0")
| p02223 | <span class="lang">
<span class="lang-ja">
<h1>M: 文字列集合</h1>
<div class="part">
<section>
<h3>問題文</h3><p>以下の条件を満たす文字列集合 $S$ のうち、要素数が最大となるものを $1$ つ構成してください。</p>
<ul>
<li>$S$ に含まれる文字列の長さは $1$ 以上 $N$ 以下である。</li>
<li>$S$ に含まれる文字列の長さはそれぞれ異なる。</li>
<li>$S$ に含まれる文字列は、文字 <code>0</code>, <code>1</code> のみからなる。</li>
<li>$S$ に含ま... | 2
| 2
0
11
| 27,930 |
s473423514 | p02223 | u740238212 | 1584681158 | Python | Python3 | py | Accepted | 20 | 5616 | 187 | K = int(input())
if K==1:
print(1)
print(0)
elif K==2:
print(2)
print(0)
print(11)
elif K >= 3:
print(K-1)
for i in range(K-1):
print("0"+"1"*i+"0")
| p02223 | <span class="lang">
<span class="lang-ja">
<h1>M: 文字列集合</h1>
<div class="part">
<section>
<h3>問題文</h3><p>以下の条件を満たす文字列集合 $S$ のうち、要素数が最大となるものを $1$ つ構成してください。</p>
<ul>
<li>$S$ に含まれる文字列の長さは $1$ 以上 $N$ 以下である。</li>
<li>$S$ に含まれる文字列の長さはそれぞれ異なる。</li>
<li>$S$ に含まれる文字列は、文字 <code>0</code>, <code>1</code> のみからなる。</li>
<li>$S$ に含ま... | 2
| 2
0
11
| 27,931 |
s406156237 | p02223 | u589808262 | 1584679037 | Python | Python3 | py | Accepted | 30 | 6084 | 995 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for ... | p02223 | <span class="lang">
<span class="lang-ja">
<h1>M: 文字列集合</h1>
<div class="part">
<section>
<h3>問題文</h3><p>以下の条件を満たす文字列集合 $S$ のうち、要素数が最大となるものを $1$ つ構成してください。</p>
<ul>
<li>$S$ に含まれる文字列の長さは $1$ 以上 $N$ 以下である。</li>
<li>$S$ に含まれる文字列の長さはそれぞれ異なる。</li>
<li>$S$ に含まれる文字列は、文字 <code>0</code>, <code>1</code> のみからなる。</li>
<li>$S$ に含ま... | 2
| 2
0
11
| 27,932 |
s353230824 | p02223 | u611853667 | 1584678786 | Python | Python3 | py | Accepted | 30 | 5616 | 196 | n = int(input())
if n == 1:
print(1)
print(0)
exit()
if n == 2:
print(2)
print(0)
print(11)
exit()
print(n-1)
for i in range(n-1):
print("1" + "0"*i + "1")
| p02223 | <span class="lang">
<span class="lang-ja">
<h1>M: 文字列集合</h1>
<div class="part">
<section>
<h3>問題文</h3><p>以下の条件を満たす文字列集合 $S$ のうち、要素数が最大となるものを $1$ つ構成してください。</p>
<ul>
<li>$S$ に含まれる文字列の長さは $1$ 以上 $N$ 以下である。</li>
<li>$S$ に含まれる文字列の長さはそれぞれ異なる。</li>
<li>$S$ に含まれる文字列は、文字 <code>0</code>, <code>1</code> のみからなる。</li>
<li>$S$ に含ま... | 2
| 2
0
11
| 27,933 |
s196303440 | p02233 | u424720817 | 1531545288 | Python | Python3 | py | Accepted | 20 | 5608 | 307 | def memolize(f):
cache = {}
def helper(x):
if x not in cache:
cache[x] = f(x)
return cache[x]
return helper
@memolize
def fib(n):
if n == 0:
return 1
elif n == 1:
return 1
return fib(n - 1) + fib(n - 2)
n = int(input())
print(fib(n))
| p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,936 |
s212887002 | p02233 | u424720817 | 1531801319 | Python | Python3 | py | Accepted | 20 | 5612 | 307 | def memolize(f):
cache = {}
def helper(x):
if x not in cache:
cache[x] = f(x)
return cache[x]
return helper
@memolize
def fib(n):
if n == 0:
return 1
elif n == 1:
return 1
return fib(n - 1) + fib(n - 2)
n = int(input())
print(fib(n))
| p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,937 |
s240624562 | p02233 | u300095814 | 1531802865 | Python | Python3 | py | Accepted | 20 | 5608 | 339 | N = int(input())
def memorize(f) :
cache = {}
def helper(*args) :
if args not in cache :
cache[args] = f(*args)
return cache[args]
return helper
@memorize
def fibonacci(n):
if n == 0 or n == 1:
return 1
res = fibonacci(n - 2) + fibonacci(n - 1)
return res
p... | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,938 |
s047854819 | p02233 | u300095814 | 1531802896 | Python | Python3 | py | Accepted | 20 | 5612 | 339 | N = int(input())
def memorize(f) :
cache = {}
def helper(*args) :
if args not in cache :
cache[args] = f(*args)
return cache[args]
return helper
@memorize
def fibonacci(n):
if n == 0 or n == 1:
return 1
res = fibonacci(n - 2) + fibonacci(n - 1)
return res
p... | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,939 |
s994610588 | p02233 | u316584871 | 1535677471 | Python | Python3 | py | Accepted | 20 | 5600 | 102 | n = int(input())
f = [1,1]
for i in range(n-1):
fib = f[-1] + f[-2]
f.append(fib)
print(f[n])
| p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,940 |
s555427515 | p02233 | u025180675 | 1540808876 | Python | Python3 | py | Accepted | 20 | 5604 | 229 | n = int(input().strip())
if n == 0:
print(1)
elif n == 1:
print(1)
else:
lst = [0 for i in range(0,n+1)]
lst[0] = 1
lst[1] = 1
for i in range(0,n-1):
lst[i+2] = lst[i+1] + lst[i]
print(lst[n])
| p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,941 |
s126604060 | p02233 | u623996423 | 1540977146 | Python | Python3 | py | Accepted | 20 | 5600 | 201 | def fib(n):
if n ==0 or n == 1:
return 1
l = [0] * (n+1)
l[0] = 1
l[1] = 1
for i in range(2,n+1):
l[i] = l[i-2] + l[i-1]
return l[i]
print(fib(int(input())))
| p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,942 |
s641396739 | p02233 | u665008200 | 1546132651 | Python | Python3 | py | Accepted | 20 | 5600 | 187 | n = int(input())
fib = [0] * (n + 1)
if n == 0 or n == 1:
print(1)
exit()
fib[0] = 1
fib[1] = 1
for i in range(2, n + 1):
fib[i] = fib[i - 1] + fib[i -2]
print(fib[-1])
| p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,943 |
s493723140 | p02233 | u165578704 | 1556380730 | Python | Python3 | py | Accepted | 20 | 5608 | 340 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
N=INT()
dp=[0]*50
dp[0]=dp[1]=1
for i in range(2, 50):
dp[i]=dp[i-1]+dp[... | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,944 |
s417901292 | p02233 | u165578704 | 1556381182 | Python | Python3 | py | Accepted | 20 | 5608 | 398 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
N=INT()
memo=[0]*50
memo[0]=memo[1]=1
def rec(n):
if memo[n]:
re... | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,945 |
s835389106 | p02233 | u506537276 | 1559542290 | Python | Python3 | py | Accepted | 20 | 5604 | 140 | fib = [0 for i in range(45)]
fib[0] = 1
fib[1] = 1
for i in range(2, 45):
fib[i] = fib[i - 1] + fib[i - 2]
n = int(input())
print(fib[n])
| p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,946 |
s642270489 | p02233 | u580607517 | 1421150696 | Python | Python | py | Accepted | 10 | 4216 | 180 | cache = {}
def fib(x):
if x in cache:
return cache[x]
elif x == 0 or x == 1:
return 1
else:
v = fib(x - 1) + fib(x - 2)
cache[x] = v
return v
x = input()
print fib(x) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,947 |
s325173521 | p02233 | u567380442 | 1422184899 | Python | Python3 | py | Accepted | 40 | 6728 | 315 | def memoize(f):
cache = {}
def helper(x):
if x not in cache:
cache[x] = f(x)
return cache[x]
return helper
@memoize
def fib(n):
if n in (0, 1):
return 1
else:
return fib(n - 1) + fib(n - 2)
print(fib(int(input()))) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,948 |
s384457438 | p02233 | u370429022 | 1426614626 | Python | Python3 | py | Accepted | 30 | 6728 | 205 | def fib(n):
def iter(a, b, cnt):
if cnt == 0:
return a
return iter(b, a+b, cnt-1)
return iter(1, 1, n)
if __name__ == '__main__':
n = int(input())
print(fib(n)) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,949 |
s634073101 | p02233 | u809822290 | 1435214003 | Python | Python3 | py | Accepted | 30 | 6724 | 119 | def Fibonacci(n, a1, a2):
if n<1 : return a1
return Fibonacci(n-1,a1+a2,a1)
print( Fibonacci( int(input()), 1, 0 ) ) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,950 |
s488996832 | p02233 | u035108350 | 1440398784 | Python | Python3 | py | Accepted | 20 | 7752 | 207 | def fib(n):
global f
if f[n]==False:
val=fib(n-1)+fib(n-2)
f[n]=val
return val
else:
return f[n]
n=int(input())
N=44+1
f=[1,1]
f.extend([0]*N)
fib(N)
print(f[n]) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,951 |
s402403598 | p02233 | u669284080 | 1448612180 | Python | Python3 | py | Accepted | 30 | 7680 | 140 | #!/usr/bin/python3
# main
n = int(input()) - 1
fib = [1, 2]
for i in range(2, n + 1):
fib.append(fib[i - 1] + fib[i - 2])
print(fib[n]) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,952 |
s114643704 | p02233 | u881590806 | 1450188876 | Python | Python | py | Accepted | 10 | 6444 | 251 | n = int(raw_input())
dp = {}
def fib(n):
if n in dp: return dp[n]
if n == 0:
dp[n] = 1
return 1
elif n == 1:
dp[n] = 1
return 1
else:
dp[n] = fib(n-1)+fib(n-2)
return dp[n]
print fib(n) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,953 |
s226756731 | p02233 | u488601719 | 1450339415 | Python | Python | py | Accepted | 10 | 6448 | 226 | n = input()
if n == 0:
print(1)
elif n == 1:
print(1)
else:
fib = [0 for i in range(n + 1)]
fib[0] = 1
fib[1] = 1
for i in range(2, n + 1):
fib[i] = fib[i - 1] + fib[i - 2]
print(fib[n]) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,954 |
s710251878 | p02233 | u630546605 | 1450391902 | Python | Python | py | Accepted | 10 | 6432 | 266 | #-------------------------------------------------------------------------------
# coding: utf-8
# Created: 16/12/2015
import sys
io = sys.stdin
n = io.readline()
a0, a1 = [1, 1]
a2 = 1
for i in xrange(int(n)-1):
a2 = a0 + a1
a0, a1 = a1, a2
print a2 | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,955 |
s938969766 | p02233 | u619765879 | 1453257564 | Python | Python | py | Accepted | 10 | 6432 | 189 | def fib(n):
if F[n] != 0:
return F[n]
elif n==0 or n==1:
F[n] = 1
else:
F[n] = fib(n-1) + fib(n-2)
return F[n]
n = input()
F = [0 for row in range(n+1)]
print fib(n) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,956 |
s696955566 | p02233 | u731976921 | 1453257603 | Python | Python | py | Accepted | 10 | 6428 | 204 | def fib_iter(n):
fib_n = 1
fib_n2 = 1
fib_n1 = 1
for i in range(n - 1):
fib_n = fib_n1 + fib_n2
fib_n2 = fib_n1
fib_n1 = fib_n
return fib_n
x = int(raw_input())
print fib_iter(x) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,957 |
s903825674 | p02233 | u731976921 | 1453257685 | Python | Python | py | Accepted | 10 | 6436 | 192 | memo = {}
def fib_memo(n):
if n <= 1:
return 1
if n in memo:
return memo[n]
memo[n] = fib_memo(n - 1) + fib_memo(n - 2)
return memo[n]
x = int(raw_input())
print fib_memo(x) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,958 |
s411507531 | p02233 | u797673668 | 1454225429 | Python | Python3 | py | Accepted | 20 | 7744 | 308 | n = int(input())
def memoize(f):
memo = [1, 1] + [0] * max(0, n - 1)
def main(i):
if memo[i]:
return memo[i]
result = memo[i] = f(i)
return result
return main
@memoize
def fibonacci(i):
return fibonacci(i - 1) + fibonacci(i - 2)
print(fibonacci(n)) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,959 |
s289258579 | p02233 | u341533698 | 1454954079 | Python | Python | py | Accepted | 10 | 6472 | 461 | n = int(raw_input())
F = [0] * (n+1)
def fibonacci(n):
global F
if n == 0 or n == 1:
F[n] = 1
return F[n]
if F[n] != 0:
return F[n]
F[n] = fibonacci(n-2) + fibonacci(n-1)
return F[n]
def makeFibonacci(n):
global F
F[0] = 1
F[1] = 1
for i in xrange(2,n+1):
... | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,960 |
s251551237 | p02233 | u247976584 | 1455709468 | Python | Python3 | py | Accepted | 30 | 7692 | 203 | class Fib():
f = [1] * 50
def fib(self, n):
for i in range(2, n + 1):
self.f[i] = self.f[i - 1] + self.f[i - 2]
return(self.f[n])
x = Fib()
print(x.fib(int(input()))) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,961 |
s129799907 | p02233 | u224288634 | 1456570518 | Python | Python | py | Accepted | 10 | 6444 | 258 |
fibo_list=[0 for i in range(48)]
def fibo(n):
f=fibo_list[n]
if f:
return f
else:
if n==0 or n==1:
return 1
else:
f=fibo(n-1)+(fibo(n-2))
fibo_list[n]=f
return f
n=input()
print(fibo(n)) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,962 |
s064663967 | p02233 | u731710433 | 1456989874 | Python | Python3 | py | Accepted | 40 | 7728 | 148 | def fib(n):
n1 = n2 = tmp = 1
for _ in range(n - 1):
tmp = n1 + n2
n1, n2 = n2, tmp
return tmp
print(fib(int(input()))) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,963 |
s135683346 | p02233 | u648595404 | 1458826817 | Python | Python3 | py | Accepted | 50 | 7656 | 69 | a,b = 1,1
n = int(input())
for i in range(n):
a,b = b,a+b
print(a) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,964 |
s240982107 | p02233 | u224288634 | 1458981411 | Python | Python | py | Accepted | 20 | 6444 | 183 | def fibo(n):
S=[1,1]
s=1
if n>1:
for i in range(2,n+1):
S.append(S[i-1]+S[i-2])
s=S[i]
return s
def main():
if __name__=="__main__":
n=input()
print(fibo(n))
main() | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,965 |
s356283642 | p02233 | u224288634 | 1458981473 | Python | Python3 | py | Accepted | 20 | 7756 | 188 | def fibo(n):
S=[1,1]
s=1
if n>1:
for i in range(2,n+1):
S.append(S[i-1]+S[i-2])
s=S[i]
return s
def main():
if __name__=="__main__":
n=int(input())
print(fibo(n))
main() | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,966 |
s268324649 | p02233 | u072053884 | 1460171525 | Python | Python3 | py | Accepted | 40 | 7736 | 140 | def fib2(n):
a1, a2 = 1, 0
while n > 0:
a1, a2 = a1 + a2, a1
n -= 1
return a1
n = int(input())
print(fib2(n)) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,967 |
s700069314 | p02233 | u072053884 | 1460173755 | Python | Python3 | py | Accepted | 20 | 7748 | 221 | answer_list = [1, 1] + [None] * 43
def fib(num):
ans = answer_list[num]
if ans:
return ans
ans = fib(num - 1) + fib(num - 2)
answer_list[num] = ans
return ans
n = int(input())
print(fib(n)) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,968 |
s923491183 | p02233 | u072053884 | 1460275581 | Python | Python3 | py | Accepted | 30 | 7764 | 343 | def deco_fibo(func):
answer_list = [1, 1] + [None] * 43
def main_fibo(i):
ans = answer_list[i]
if ans:
return ans
ans = func(i)
answer_list[i] = ans
return ans
return main_fibo
@deco_fibo
def fibo(num):
return fibo(num - 1) + fibo(num - 2)
n = int(i... | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,969 |
s974099194 | p02233 | u130979865 | 1461064521 | Python | Python | py | Accepted | 10 | 6440 | 129 | # -*- coding: utf-8 -*-
fib = [1, 1]
for i in range(2, 45):
fib.append(fib[i-1]+fib[i-2])
n = int(raw_input())
print fib[n] | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,970 |
s356071100 | p02233 | u894114233 | 1461070082 | Python | Python | py | Accepted | 10 | 6444 | 168 | def fibonum():
global F
F[0]=1
F[1]=1
for i in xrange(2,n+1):
F[i]=F[i-1]+F[i-2]
return F[n]
n=input()
F=[0]*(n+1)
num=fibonum()
print(num) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,971 |
s001138244 | p02233 | u567281053 | 1461327250 | Python | Python | py | Accepted | 10 | 6456 | 179 | def fib(n):
if ft[n] != 0:
return ft[n]
else:
ft[n] = fib(n - 1) + fib(n - 2)
return ft[n]
ft = [0] * 45
ft[0] = ft[1] = 1
print fib(int(input())) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,972 |
s675365162 | p02233 | u342312206 | 1464888682 | Python | Python3 | py | Accepted | 20 | 7732 | 2,799 | def fib(n, fib_memo=None):
if fib_memo == None: ... | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,973 |
s610778537 | p02233 | u949338836 | 1464929938 | Python | Python3 | py | Accepted | 40 | 7728 | 363 | #coding:utf-8
#1_10_A
def fibo(n, numbers):
if n == 0 or n == 1:
numbers[n] = 1
return numbers[n]
elif numbers[n]:
return numbers[n]
else:
numbers[n] = fibo(n - 1, numbers) + fibo(n - 2, numbers)
return numbers[n]
n = int(input())
fibonacci_numbers = [0 for i in rang... | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,974 |
s684333901 | p02233 | u984009739 | 1467221322 | Python | Python3 | py | Accepted | 50 | 7712 | 109 | F =[1,1] + [0 for i in range(44)]
n = int(input())
for i in range(2,n+1):
F[i]=F[i-1]+F[i-2]
print(F[n]) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,975 |
s265055480 | p02233 | u569960318 | 1467276355 | Python | Python3 | py | Accepted | 20 | 7720 | 263 | def fib(n):
F = {0:1, 1:1}
def fibonacci(n):
ans = F.get(n,-1)
if ans > 0: return ans
F[n] = fibonacci(n-1) + fibonacci(n-2)
return F[n]
return fibonacci(n)
if __name__=='__main__':
print(fib(int(input()))) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,976 |
s874326164 | p02233 | u661326643 | 1467728746 | Python | Python | py | Accepted | 10 | 6424 | 163 | if __name__ == "__main__":
n = input()
F = []
F.append(1)
F.append(1)
for i in range(2,n+1):
F.append(F[i-1] + F[i-2])
print(F[n]) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,977 |
s374229940 | p02233 | u611490888 | 1468321593 | Python | Python | py | Accepted | 10 | 6380 | 492 | # -*- coding: utf-8 -*-
memo = ['' for i in xrange(45)]
def recursion(n):
if n == 0 or n == 1:
return 1
return recursion(n - 1) + recursion(n - 2)
def memo_search(n):
if memo[n] != '':
return memo[n]
else:
if n == 0 or n == 1:
memo[n] = 1
return 1
... | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,978 |
s890707742 | p02233 | u611490888 | 1468391183 | Python | Python | py | Accepted | 20 | 6444 | 903 | # -*- coding: utf-8 -*-
memo = ['' for i in xrange(45)]
dp = [0 for i in xrange(45)]
# ?????°?????¨?¨??????????O(2^n)?????????
def recursion(n):
if n == 0 or n == 1:
return 1
return recursion(n - 1) + recursion(n - 2)
# ?????¢??????????????°?¨??????????O(n)?????§????????§??????
def memo_search(n):... | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,979 |
s007256810 | p02233 | u918457647 | 1469118184 | Python | Python3 | py | Accepted | 40 | 7648 | 115 | n = int(input())
fib = [1]*2 + [0]*(n-1)
for i in range(2, n+1):
fib[i] = fib[i-1] + fib[i-2]
print(fib[n]) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,980 |
s888062775 | p02233 | u881590806 | 1469455656 | Python | Python | py | Accepted | 10 | 6408 | 290 | def fib(memo,n):
if n in memo:
return memo[n]
else:
if n == 0:
return 1
elif n == 1:
return 1
else:
memo[n] = fib(memo,n-1)+fib(memo,n-2)
return memo[n]
memo = {}
n = int(raw_input())
print fib(memo,n) | p02233 |
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});
</script>
<script language="JavaScript" type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML">
</script>
<H1>Fibonacci Number</H1>
<p>
... | 3
| 3
| 27,981 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.