paizaラーニングレベルアップ問題集の【条件分岐メニュー】をやってみた (1)

paizaラーニングレベルアップ問題集の【条件分岐メニュー】をやってみました。
- - -
##### 問題
###### 単純な条件分岐
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__simple_step1
###### 数値の分岐
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__simple_step2
###### 数値演算結果で分岐
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__simple_step3
###### ゼロ以外
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__simple_step4
###### 0が含まれていないか判定
https://paiza.jp/works/mondai/conditions_branch/conditions_branch__simple_boss
- - -
##### 方針
- 最初の3問は[コチラ](https://qiita.com/anonymously115/items/222e07750c4dfae1aa07)と同じです
- `if`文を使ったコードと三項演算子を使ったコードを掲載します
- 最終問題は$0$が入力された時点で`NO`を出力してプログラムを終了する方法もありますが、一応、入力は全て読み込みたいと思います
    - が、読者諸賢におかれましては、本当に「全て読み込」まれているか、ご確認いただきたいと思います。例えば
        ```
        ans = ans && (int(input()) != 0)
        ```
        の様なコードでは、変数`ans`が既に偽の場合、`int(input())`の評価はされません。即ち、入力が読み込まれません
- - -
##### C
###### 単純な条件分岐
```c
#include <stdio.h>
#include <string.h>

int main() {
	char s[20];
	scanf("%s", s);
	if (strcmp(s, "paiza") == 0) {
		puts("YES");
	} else {
		puts("NO");
	}
	return 0;
}
```
```c
#include <stdio.h>
#include <string.h>

int main() {
	char s[20];
	scanf("%s", s);
	puts(strcmp(s, "paiza") ? "NO" : "YES");
	return 0;
}
```
###### 数値の分岐
```c
#include <stdio.h>

int main() {
	int n;
	scanf("%d", &n);
	if (n <= 100) {
		puts("YES");
	} else {
		puts("NO");
	}
	return 0;
}
```
```c
#include <stdio.h>

int main() {
	int n;
	scanf("%d", &n);
	puts(n <= 100 ? "YES" : "NO");
	return 0;
}
```
###### 数値演算結果で分岐
```c
#include <stdio.h>

int main() {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (a * b <= c) {
		puts("YES");
	} else {
		puts("NO");
	}
	return 0;
}
```
```c
#include <stdio.h>

int main() {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	puts(a * b <= c ? "YES" : "NO");
	return 0;
}
```
###### ゼロ以外
```c
#include <stdio.h>

int main() {
	int n;
	scanf("%d", &n);
	if (n) {
		puts("YES");
	} else {
		puts("NO");
	}
	return 0;
}
```
```c
#include <stdio.h>

int main() {
	int n;
	scanf("%d", &n);
	puts(n ? "YES" : "NO");
	return 0;
}
```
###### 0が含まれていないか判定
```c
#include <stdio.h>

int main() {
	int n;
	scanf("%d", &n);
	char* ans = "YES";
	for (int i = 0; i < n; i++) {
		int a;
		scanf("%d", &a);
		if (!a) ans = "NO";
	}
	puts(ans);
	return 0;
}
```
```c
#include <stdio.h>

int main() {
	int n;
	scanf("%d", &n);
	int ans = 1;
	while (n--) {
		int a;
		scanf("%d", &a);
		ans = ans && a;
	}
	puts(ans ? "YES" : "NO");
	return 0;
}
```
- - -
##### C++
###### 単純な条件分岐
```cpp
#include <iostream>
using namespace std;

int main() {
	string s;
	cin >> s;
	if (s == "paiza") {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}
```
```cpp
#include <iostream>
using namespace std;

int main() {
	string s;
	cin >> s;
	cout << (s == "paiza" ? "YES" : "NO") << endl;
	return 0;
}
```
###### 数値の分岐
```cpp
#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	if (n <= 100) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}
```
```cpp
#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	cout << (n <= 100 ? "YES" : "NO") << endl;
	return 0;
}
```
###### 数値演算結果で分岐
```cpp
#include <iostream>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a * b <= c) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}
```
```cpp
#include <iostream>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << (a * b <= c ? "YES" : "NO") << endl;
	return 0;
}
```
###### ゼロ以外
```cpp
#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	if (n) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}
```
```cpp
#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	cout << (n ? "YES" : "NO") << endl;
	return 0;
}
```
###### 0が含まれていないか判定
```cpp
#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	string ans = "YES";
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (!a) ans = "NO";
	}
	cout << ans << endl;
	return 0;
}
```
```cpp
#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	bool ans = true;
	while (n--) {
		int a;
		cin >> a;
		ans = ans && a;
	}
	cout << (ans ? "YES" : "NO") << endl;
	return 0;
}
```
- - -
##### C#
###### 単純な条件分岐
```cs
using System;

class Program
{
	public static void Main()
	{
		string s = Console.ReadLine();
		if ("paiza".Equals(s)) {
			Console.WriteLine("YES");
		} else {
			Console.WriteLine("NO");
		}
	}
}
```
```cs
using System;

class Program
{
	public static void Main()
	{
		Console.WriteLine("paiza".Equals(Console.ReadLine()) ? "YES" : "NO");
	}
}
```
###### 数値の分岐
```cs
using System;

class Program
{
	public static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		if (n <= 100) {
			Console.WriteLine("YES");
		} else {
			Console.WriteLine("NO");
		}
	}
}
```
```cs
using System;

class Program
{
	public static void Main()
	{
		Console.WriteLine(int.Parse(Console.ReadLine()) <= 100 ? "YES" : "NO");
	}
}
```
###### 数値演算結果で分岐
```cs
using System;

class Program
{
	public static void Main()
	{
		int[] abc = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int a = abc[0];
		int b = abc[1];
		int c = abc[2];
		if (a * b <= c) {
			Console.WriteLine("YES");
		} else {
			Console.WriteLine("NO");
		}
	}
}
```
```cs
using System;

class Program
{
	public static void Main()
	{
		int[] abc = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int a = abc[0];
		int b = abc[1];
		int c = abc[2];
		Console.WriteLine(a * b <= c ? "YES" : "NO");
	}
}
```
###### ゼロ以外
```cs
using System;

class Program
{
	public static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		if (n != 0) {
			Console.WriteLine("YES");
		} else {
			Console.WriteLine("NO");
		}
	}
}
```
```cs
using System;

class Program
{
	public static void Main()
	{
		Console.WriteLine(int.Parse(Console.ReadLine()) != 0 ? "YES" : "NO");
	}
}
```
###### 0が含まれていないか判定
```cs
using System;

class Program
{
	public static void Main()
	{
		int n = int.Parse(Console.ReadLine());
		string ans = "YES";
		for (int i = 0; i < n; i++) {
			int a = int.Parse(Console.ReadLine());
			if (a == 0) ans = "NO";
		}
		Console.WriteLine(ans);
	}
}
```
```cs
using System;
using System.Linq;

class Program
{
	static void Main()
	{
		Console.WriteLine(Enumerable.Range(0, int.Parse(Console.ReadLine())).Select(_ => int.Parse(Console.ReadLine())).ToArray().All(_ => _ != 0) ? "YES" : "NO");
	}
}
```
- - -
##### Go
###### 単純な条件分岐
```go
package main
import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	if s == "paiza" {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
```
###### 数値の分岐
```go
package main
import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	if n <= 100 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
```
###### 数値演算結果で分岐
```go
package main
import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	if a * b <= c {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
```
###### ゼロ以外
```go
package main
import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	if n != 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
```
###### 0が含まれていないか判定
```go
package main
import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	ans := "YES"
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		if a == 0 {
			ans = "NO"
		}
	}
	fmt.Println(ans)
}
```
- - -
##### Java
###### 単純な条件分岐
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		if ("paiza".equals(s)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}
```
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println("paiza".equals(sc.next()) ? "YES" : "NO");
		sc.close();
	}
}
```
###### 数値の分岐
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		if (n <= 100) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}
```
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(sc.nextInt() <= 100 ? "YES" : "NO");
		sc.close();
	}
}
```
###### 数値演算結果で分岐
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		sc.close();
		if (a * b <= c) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}
```
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(sc.nextInt() * sc.nextInt() <= sc.nextInt() ? "YES" : "NO");
		sc.close();
	}
}
```
###### ゼロ以外
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		if (n != 0) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}
```
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(sc.nextInt() != 0 ? "YES" : "NO");
		sc.close();
	}
}
```
###### 0が含まれていないか判定
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String ans = "YES";
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			if (a == 0) {
				ans = "NO";
			}
		}
		sc.close();
		System.out.println(ans);
	}
}
```
```java
import java.util.*;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println(Arrays.stream(IntStream.range(0, sc.nextInt()).map(i -> sc.nextInt()).toArray()).noneMatch(i -> i == 0) ? "YES" : "NO");
		sc.close();
	}
}
```
- - -
##### JavaScript
###### 単純な条件分岐
```js
const s = require("fs").readFileSync("/dev/stdin", "utf8").trim();
if (s === "paiza") {
	console.log("YES");
} else {
	console.log("NO");
}
```
```js
console.log(require("fs").readFileSync("/dev/stdin", "utf8").trim() === "paiza" ? "YES" : "NO");
```
###### 数値の分岐
```js
const n = Number(require("fs").readFileSync("/dev/stdin", "utf8"));
if (n <= 100) {
	console.log("YES");
} else {
	console.log("NO");
}
```
```js
console.log(Number(require("fs").readFileSync("/dev/stdin", "utf8")) <= 100 ? "YES" : "NO");
```
###### 数値演算結果で分岐
```js
const [a, b, c] = require("fs").readFileSync("/dev/stdin", "utf8").split(' ').map(Number);
if (a * b <= c) {
	console.log("YES");
} else {
	console.log("NO");
}
```
```js
const [a, b, c] = require("fs").readFileSync("/dev/stdin", "utf8").split(' ');
console.log(a * b <= c ? "YES" : "NO");
```
###### ゼロ以外
```js
const n = Number(require("fs").readFileSync("/dev/stdin", "utf8"));
if (n) {
	console.log("YES");
} else {
	console.log("NO");
}
```
```js
console.log(Number(require("fs").readFileSync("/dev/stdin", "utf8")) ? "YES" : "NO");
```
###### 0が含まれていないか判定
```js
const A = require("fs").readFileSync("/dev/stdin", "utf8").trim().split('\n').map(Number);
const n = A[0];
let ans = "YES";
for (var i = 1; i <= n; i++) {
	const a = A[i];
	if (!a) {
		ans = "NO";
	}
}
console.log(ans);
```
```js
const [n, ...A] = require("fs").readFileSync("/dev/stdin", "utf8").trim().split('\n').map(Number);
console.log(A.every(a => a) ? "YES" : "NO");
```
- - -
##### Kotlin
###### 単純な条件分岐
```kotlin
fun main() {
	val s = readLine()!!
	if ("paiza".equals(s)) {
		println("YES")
	} else {
		println("NO")
	}
}
```
```kotlin
fun main() {
	println(if ("paiza".equals(readLine()!!)) "YES" else "NO")
}
```
###### 数値の分岐
```kotlin
fun main() {
	val n = readLine()!!.toInt()
	if (n <= 100) {
		println("YES")
	} else {
		println("NO")
	}
}
```
```kotlin
fun main() {
	println(if (readLine()!!.toInt() <= 100) "YES" else "NO")
}
```
###### 数値演算結果で分岐
```kotlin
fun main() {
	val (a, b, c) = readLine()!!.split(' ').map { it.toInt() }
	if (a * b <= c) {
		println("YES")
	} else {
		println("NO")
	}
}
```
```kotlin
import java.util.*

fun main() {
	val sc = Scanner(System.`in`)
	println(if (sc.nextInt() * sc.nextInt() <= sc.nextInt()) "YES" else "NO")
	sc.close()
}
```
###### ゼロ以外
```kotlin
fun main() {
	val n = readLine()!!.toInt()
	if (n != 0) {
		println("YES")
	} else {
		println("NO")
	}
}
```
```kotlin
fun main() {
	println(if (readLine()!!.toInt() != 0) "YES" else "NO")
}
```
###### 0が含まれていないか判定
```kotlin
fun main() {
	val n = readLine()!!.toInt()
	var ans = "YES"
	repeat (n) {
		val a = readLine()!!.toInt()
		if (a == 0) {
			ans = "NO"
		}
	}
	println(ans)
}
```
```kotlin
fun main() {
	println(if (Array(readLine()!!.toInt()) { readLine()!!.toInt() }.none { it == 0 }) "YES" else "NO")
}
```
- - -
##### PHP
###### 単純な条件分岐
```php
<?php
	$s = trim(fgets(STDIN));
	if ($s === "paiza") {
		echo "YES";
	} else {
		echo "NO";
	}
	echo PHP_EOL;
?>
```
```php
<?php
	echo trim(fgets(STDIN)) === "paiza" ? "YES" : "NO", PHP_EOL;
?>
```
###### 数値の分岐
```php
<?php
	$n = intval(fgets(STDIN));
	if ($n <= 100) {
		echo "YES";
	} else {
		echo "NO";
	}
	echo PHP_EOL;
?>
```
```php
<?php
	echo intval(fgets(STDIN)) <= 100 ? "YES" : "NO", PHP_EOL;
?>
```
###### 数値演算結果で分岐
```php
<?php
	[$a, $b, $c] = array_map("intval", explode(' ', trim(fgets(STDIN))));
	if ($a * $b <= $c) {
		echo "YES";
	} else {
		echo "NO";
	}
	echo PHP_EOL;
?>
```
```php
<?php
	[$a, $b, $c] = array_map("intval", explode(' ', fgets(STDIN)));
	echo $a * $b <= $c ? "YES" : "NO", PHP_EOL;
?>
```
###### ゼロ以外
```php
<?php
	$n = intval(fgets(STDIN));
	if ($n) {
		echo "YES";
	} else {
		echo "NO";
	}
	echo PHP_EOL;
?>
```
```php
<?php
	echo intval(fgets(STDIN)) ? "YES" : "NO", PHP_EOL;
?>
```
###### 0が含まれていないか判定
```php
<?php
	$n = intval(fgets(STDIN));
	$ans = "YES";
	for ($i = 0; $i < $n; $i++) {
		$a = intval(fgets(STDIN));
		if (!$a) {
			$ans = "NO";
		}
	}
	echo "$ans\n";
?>
```
```php
<?php
	$n = fgets(STDIN);
	$ans = true;
	while ($n--) {
		$ans = intval(fgets(STDIN)) && $ans;
	}
	echo $ans ? "YES" : "NO", PHP_EOL;
?>
```
- - -
##### Perl
###### 単純な条件分岐
```pl
chomp(my $s = <STDIN>);
if ($s eq "paiza") {
	print "YES";
} else {
	print "NO";
}
print $/;
```
```pl
chomp(my $s = <STDIN>);
print $s eq "paiza" ? "YES" : "NO", $/;
```
###### 数値の分岐
```pl
my $n = int(<STDIN>);
if ($n <= 100) {
	print "YES";
} else {
	print "NO";
}
print $/;
```
```pl
print int(<STDIN>) <= 100 ? "YES" : "NO", $/;
```
###### 数値演算結果で分岐
```pl
my ($a, $b, $c) = map { int($_) } split ' ', <STDIN>;
if ($a * $b <= $c) {
	print "YES";
} else {
	print "NO";
}
print $/;
```
```pl
my ($a, $b, $c) = map { int($_) } split ' ', <STDIN>;
print $a * $b <= $c ? "YES" : "NO", $/;
```
###### ゼロ以外
```pl
my $n = int(<STDIN>);
if ($n) {
	print "YES";
} else {
	print "NO";
}
print $/;
```
```pl
print int(<STDIN>) ? "YES" : "NO", $/;
```
###### 0が含まれていないか判定
```pl
my $n = int(<STDIN>);
my $ans = "YES";
for (my $i = 0; $i < $n; $i++) {
	my $a = int(<STDIN>);
	if (!$a) {
		$ans = "NO";
	}
}
print "$ans$/";
```
```pl
my ($n, @A) = map { int($_) } <STDIN>;
my $ans = 1;
for (my $i = 0; $i < $n; $i++) {
	$ans = $ans && $A[$i];
}
print $ans ? "YES" : "NO", $/;
```
- - -
##### Python3
###### 単純な条件分岐
```py
s = input()
if s == "paiza":
	print("YES")
else:
	print("NO")
```
```py
print("YES" if input() == "paiza" else "NO")
```
###### 数値の分岐
```py
n = int(input())
if n <= 100:
	print("YES")
else:
	print("NO")
```
```py
print("YES" if int(input()) <= 100 else "NO")
```
###### 数値演算結果で分岐
```py
a, b, c = map(int, input().split())
if a * b <= c:
	print("YES")
else:
	print("NO")
```
```py
a, b, c = map(int, input().split())
print("YES" if a * b <= c else "NO")
```
###### ゼロ以外
```py
n = int(input())
if n:
	print("YES")
else:
	print("NO")
```
```py
print("YES" if int(input()) else "NO")
```
###### 0が含まれていないか判定
```py
n = int(input())
ans = "YES"
for _ in range(n):
	a = int(input())
	if not a:
		ans = "NO"
print(ans)
```
```py
print("YES" if all([int(input()) for _ in range(int(input()))]) else "NO")
```
```py
print("YES" if all([int(input()) for _ in range(int(input()))]) else "NO")
```
- - -
##### Ruby
###### 単純な条件分岐
```rb
s = gets.chomp
if s == "paiza"
	puts "YES"
else
	puts "NO"
end
```
```rb
puts gets.chomp == "paiza" ? "YES" : "NO"
```
###### 数値の分岐
```rb
n = gets.to_i
if n <= 100
	puts "YES"
else
	puts "NO"
end
```
```rb
puts gets.to_i <= 100 ? "YES" : "NO"
```
###### 数値演算結果で分岐
```rb
a, b, c = gets.split.map(&:to_i)
if a * b <= c
	puts "YES"
else
	puts "NO"
end
```
```rb
a, b, c = gets.split.map(&:to_i)
puts a * b <= c ? "YES" : "NO"
```
###### ゼロ以外
```rb
n = gets.to_i
if n != 0
	puts "YES"
else
	puts "NO"
end
```
```rb
puts gets.to_i != 0 ? "YES" : "NO"
```
###### 0が含まれていないか判定
```rb
n = gets.to_i
ans = "YES"
n.times do
	a = gets.to_i
	if a == 0
		ans = "NO"
	end
end
puts ans
```
```rb
puts Array.new(gets.to_i) { gets.to_i }.none? { |a| a == 0 } ? "YES" : "NO"
```
- - -
##### Scala
###### 単純な条件分岐
```scala
import scala.io.StdIn._

object Main extends App{
	val s = readLine()
	if ("paiza".equals(s)) {
		println("YES")
	} else {
		println("NO")
	}
}
```
```scala
import scala.io.StdIn._

object Main extends App{
	println(if ("paiza".equals(readLine())) "YES" else "NO")
}
```
###### 数値の分岐
```scala
import scala.io.StdIn._

object Main extends App{
	val n = readInt()
	if (n <= 100) {
		println("YES")
	} else {
		println("NO")
	}
}
```
```scala
import scala.io.StdIn._

object Main extends App{
	println(if (readInt() <= 100) "YES" else "NO")
}
```
###### 数値演算結果で分岐
```scala
import scala.io.StdIn._

object Main extends App{
	val Array(a, b, c) = readLine().split(' ').map { _.toInt }
	if (a * b <= c) {
		println("YES")
	} else {
		println("NO")
	}
}
```
```scala
import java.util._

object Main extends App{
	val sc = new Scanner(System.in)
	println(if (sc.nextInt() * sc.nextInt() <= sc.nextInt()) "YES" else "NO")
	sc.close()
}
```
###### ゼロ以外
```scala
import scala.io.StdIn._

object Main extends App{
	val n = readInt()
	if (n != 0) {
		println("YES")
	} else {
		println("NO")
	}
}
```
```scala
import scala.io.StdIn._

object Main extends App{
	println(if (readInt() != 0) "YES" else "NO")
}
```
###### 0が含まれていないか判定
```scala
import scala.io.StdIn._

object Main extends App{
	val n = readInt()
	var ans = "YES"
	for (i <- 1 to n) {
		val a = readInt()
		if (a == 0) {
			ans = "NO"
		}
	}
	println(ans)
}
```
```scala
import scala.io.StdIn._

object Main extends App{
	println(if ((0 until readInt()).map(_ => readInt()).forall(_ != 0)) "YES" else "NO")
}
```
- - -
##### Swift
###### 単純な条件分岐
```swift
let s = readLine()!
if s == "paiza" {
	print("YES")
} else {
	print("NO")
}
```
```swift
print(readLine()! == "paiza" ? "YES" : "NO")
```
###### 数値の分岐
```swift
let n = Int(readLine()!)!
if n <= 100 {
	print("YES")
} else {
	print("NO")
}
```
```swift
print(Int(readLine()!)! <= 100 ? "YES" : "NO")
```
###### 数値演算結果で分岐
```swift
let abc = readLine()!.split(separator: " ").compactMap { Int($0) }
let (a, b, c) = (abc[0], abc[1], abc[2])
if a * b <= c {
	print("YES")
} else {
	print("NO")
}
```
```swift
let abc = readLine()!.split(separator: " ").compactMap { Int($0) }
let (a, b, c) = (abc[0], abc[1], abc[2])
print(a * b <= c ? "YES" : "NO")
```
###### ゼロ以外
```swift
let n = Int(readLine()!)!
if n != 0 {
	print("YES")
} else {
	print("NO")
}
```
```swift
print(Int(readLine()!)! != 0 ? "YES" : "NO")
```
###### 0が含まれていないか判定
```swift
let n = Int(readLine()!)!
var ans = "YES"
for _ in 0..<n {
	let a = Int(readLine()!)!
	if a == 0 {
		ans = "NO"
	}
}
print(ans)
```
```swift
let n = Int(readLine()!)!
var ans = true
for _ in 0..<n {
	ans = Int(readLine()!)! != 0 && ans
}
print(ans ? "YES" : "NO")
```