# 目標

- Pythonの復習
- 基礎的なアルゴリズムの確認
Introduction to Programming が終わったら、他のシリーズも解いていこうと思います。

## 1_1A. Hello World

problem1_1A.py
```# -*- encoding: utf-8 -*-

if __name__ == '__main__':
print('Hello World')
```

## 1_1B. X Cubic

problem1_1B.py
```# -*- encoding: utf-8 -*-

if __name__ == '__main__':
x = input()

print( int(x)**3 )
```

## 1_1C. Rectangle

problem1_1C.py
```# -*- encoding: utf-8 -*-

if __name__ == '__main__':
x = input()
a = int( x.split(' ')[0] )
b = int( x.split(' ')[1] )
print( a * b, (a + b) * 2 )
```

## 1_1D. Watch

problem1_1D.py
```# -*- encoding: utf-8 -*-

if __name__ == '__main__':
S = input()

h = int( int(S) / 3600 )
m = int( int(S) % 3600 / 60 )
s = int( int(S) % 60 )

print( str(h) + ':' + str(m) + ':' + str(s) )
```

## 1_2A. Small, Large, or Equal

problem1_2A.py
```# -*- encoding: utf-8 -*-

if __name__ == '__main__':
x = input()
a = x.split(' ')[0]
b = x.split(' ')[1]

if a > b:
print('a > b')
elif a < b:
print('a < b')
else:
print('a == b')
```

## 1_2B. Range

problem1_2B.py
```# -*- encoding: utf-8 -*-

if __name__ == '__main__':
x = input()
a = int( x.split(' ')[0] )
b = int( x.split(' ')[1] )
c = int( x.split(' ')[2] )

if a < b and b < c:
print('Yes')
else:
print('No')
```

## 1_2C. Sorting Three Numbers

problem1_2C.py
```# -*- encoding: utf-8 -*-

if __name__ == '__main__':
x = input()
a = int( x.split(' ')[0] )
b = int( x.split(' ')[1] )
c = int( x.split(' ')[2] )

if c < b:
tmp = c
c = b
b = tmp
if b < a:
tmp = a
a = b
b = tmp
if c < b:
tmp = c
c = b
b = tmp

print( str(a) + ' ' + str(b) + ' ' + str(c) )
```

## 1_2D. Circle in a Rectangle

problem1_2D.py
```# -*- encoding: utf-8 -*-

def in_rectangle(W, H, x, y, r):
flag = True

if (x - r) < 0:
flag = False
elif (x + r) > W:
flag = False
elif (y - r) < 0:
flag = False
elif (y + r) > H:
flag = False

return flag

if __name__ == '__main__':
data = input()
split_data = data.split(' ')
W = int( split_data[0] )
H = int( split_data[1] )
x = int( split_data[2] )
y = int( split_data[3] )
r = int( split_data[4] )

if in_rectangle(W, H, x, y, r):
print('Yes')
else:
print('No')
```

## 1_3A. Print Many Hello World

problem1_3A.py
```# -*- coding: utf-8 -*-

if __name__ == '__main__':
for i in range(1000):
print('Hello World')
```

## 1_3B. Print Test Cases

problem1_3B.py
```# -*- coding: utf-8 -*-

if __name__ == '__main__':
x = input()
while x != '0':
print(x)
x = input()
```

## 1_3C. Swapping Two Numbers

problem1_3C.py
```# -*- coding: utf-8 -*-

if __name__ == '__main__':
x = input()
while x != '0 0':
split_in = x.split(' ')
a = int( split_in[0] )
b = int( split_in[1] )

tmp = a
a = b
b = tmp

print( str(a) + ' ' + str(b) )
x = input()

```

## 1_3D. How Many Divisors?

problem1_3D.py
```# -*- coding: utf-8 -*-

if __name__ == '__main__':
split_in = input().split(' ')
a = int( split_in[0] )
b = int( split_in[1] )
c = int( split_in[2] )

count = 0
for i in range(a, b):
if c % i == 0:
count += 1

print(count)
```

## 1_4A. A / B Problem

problem1_4A.py
```# -*- coding: utf-8 -*-

if __name__ == '__main__':
split_in = input().split(' ')

a = int( split_in[0] )
b = int( split_in[1] )

print( str( int(a / b) ) + ' ' + str(a % b) + ' ' + str(a / b) )
```

## 1_4B. Circle

problem1_4B.py
```# -*- coding: utf-8 -*-
import math

if __name__ == '__main__':
r = float( input() )

area = r * r * math.pi
length = 2 * r * math.pi

print( str(area) + ' ' + str(length) )
```

## 1_4C. Simple Calculator

problem1_4C.py
```# -*- coding: utf-8 -*-

if __name__ == '__main__':
split_in = input().split(' ')
while split_in[1] != '?':
a  = int( split_in[0] )
op = split_in[1]
b  = int( split_in[2] )

if op == '+':
print(a+b)
elif op == '-':
print(a-b)
elif op == '*':
print(a*b)
elif op == '/':
print(a/b)

split_in = input().split(' ')
```

## 1_4D. Min, Max and Sum

problem1_4D.py
```# -*- coding: utf-8 -*-

if __name__ == '__main__':
n = int( input() )
array = input().split(' ')

array = [ int(i) for i in array ]

min_val = min(array)
max_val = max(array)
sum_val = sum(array)

print( str(min_val) + ' ' + str(max_val) + ' ' + str(sum_val) )
```

## 1_5A. Print a Rectangle

problem1_5A.py
```# -*- coding: utf-8 -*-

if __name__ == '__main__':
split_in = input().split(' ')

while not (split_in[0] == '0' and split_in[1] == '0'):
for i in range( int(split_in[0]) ):
for j in range( int(split_in[1]) ):
print( '#', end='' )
print()
split_in = input().split(' ')

```

## 1_5B. Print a Frame

problem1_5B.py
```# -*- encoding: utf-8 -*-

if __name__ == '__main__':
split_in = input().split(' ')

while not( split_in[0] == '0' and split_in[1] == '0' ):
H = int( split_in[0] )
W = int( split_in[1] )
for i in range(H):
if i == 0 or i == (H-1):
for j in range(W):
print('#', end='')
else:
for j in range(W):
if j == 0 or j == (W-1):
print('#', end='')
else:
print('.', end='')
print()
split_in = input().split(' ')
```

## 1_5C. Print a Chessboard

problem1_5C.py
```# -*- coding: utf-8 -*-

if __name__ == '__main__':
split_in = input().split(' ')

while not( split_in[0] =='0' and split_in[1] == '0' ):
H = int( split_in[0] )
W = int( split_in[1] )

char = ['#', '.']
for i in range(H):
if i % 2 == 0:
for j in range(W):
print( char[j % 2], end='' )
else:
for j in range(W):
print( char[(j+1) % 2], end='' )

print()
split_in = input().split(' ')

```

## 1_5D. Structured Programming

problem1_5D.py
```# -*- coding: utf-8 -*-

def call(n):
for i in range(n + 1):
if i % 3 == 0:
print( ' ' + str(i), end='' )
else:
x = i
while i != 0:
if i % 10 == 3:
print( ' ' + str(x), end='' )
i = int(i / 10)

print()

if __name__ == '__main__':
n = input()
call( int(n) )
```

とりあえず、今回はここまでにします。

# 感想

• リストや辞書などPython独自の構文を使えたので、復習になった。
• - アルゴリズムとしては、基礎の基礎だったので、悩むことなく問題を解けた。

もっとこうした方がいいよなど気になった点があればコメントください