LoginSignup
0
0

【Paiza問題集】条件分岐メニュー/0が含まれていないか判定

Posted at

Paiza問題集

条件分岐メニュー/0が含まれていないか判定

Step01 単純な条件分岐

step01
"""
単純な条件分岐
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__simple_step1

問題
文字列Sが与えられます
Sがpaizaと一致する場合はYESを、一致しない場合はNOを出力してください
"""

print("YES" if input() == "paiza" else "NO")

Step02 数値の分岐

Step02
"""
数値の分岐
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__simple_step2

問題
整数Nが与えられます
Nが100以下の場合はYESを、そうではない場合はNOを出力してください
"""

print("YES" if int(input()) <= 100 else "NO")

Step03 数値演算結果で分岐

step03
"""
数値演算結果で分岐
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__simple_step3

問題
整数A,B,Cが与えられます
式A×B≦Cが成立している場合はYESを、そうではない場合はNOを出力してください
"""

A, B, C = map(int, (input().split()))

print("YES" if A*B<=C else "NO")

Step04 ゼロ以外

Step04
"""
ゼロ以外
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__simple_step4

問題
整数 N が与えられます
Nが0ではない場合はYESを、0である場合はNOを出力してください
"""

print("YES" if int(input()) != 0 else "NO")

Final問題 0が含まれていないか判定

Final問題
"""
0が含まれていないか判定
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__simple_boss

問題
長さNの数列Aが与えられます
Aの中に0が含まれていない場合はYESを、0が含まれている場合はNOを出力してください
"""

N = int(input())
A = [int(input()) for i in range(N)]

print("YES" if 0 not in A else "NO")
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0