paizaラーニングレベルアップ問題集の「乗客人数」をやってみた。

paizaラーニングレベルアップ問題集の[乗客人数](https://paiza.jp/works/mondai/d_rank_level_up_problems/d_rank_level_up_problems__accompanied_by_stdin_boss)をやってみました。
- - -
###### 問題
https://paiza.jp/works/mondai/d_rank_level_up_problems/d_rank_level_up_problems__accompanied_by_stdin_boss
- - -
###### 方針1
> ある電車に$a$人が乗っています。
- 変数$N$を$a$で初期化します
> 駅に到着した時に$b$人が降りて
- $N$から$b$を引いた値を$N$へ代入します
> 新たに$c$人が乗車する
- $N$に$c$を足した値を$N$へ代入します
###### 方針2
- 直接$a-b+c$を出力します
- - -
###### C
```c
#include <stdio.h>

int main() {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	int n = a;
	n -= b;
	n += c;
	printf("%d\n", n);
	return 0;
}
```
```c
#include <stdio.h>

int main() {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	printf("%d\n", a - b + c);
	return 0;
}
```
- - -
###### C++
```cpp
#include <iostream>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int n = a;
	n -= b;
	n += c;
	cout << n << endl;
	return 0;
}
```
```cpp
#include <iostream>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << a - b + c << endl;
	return 0;
}
```
- - -
###### C#
```cs
using System;

class Program
{
	public static void Main()
	{
		int[] abc = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int n = abc[0];
		n -= abc[1];
		n += abc[2];
		Console.WriteLine(n);
	}
}
```
```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);
	}
}
```
- - -
###### Go
```go
package main
import "fmt"

func main() {
	var a, b, c int
	fmt.Scanf("%d %d %d", &a, &b, &c)
	n := a
	n -= b
	n += c
	fmt.Println(n)
}
```
```go
package main
import "fmt"

func main() {
	var a, b, c int
	fmt.Scanf("%d %d %d", &a, &b, &c)
	fmt.Println(a - b + c)
}
```
- - -
###### Java
```java
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		n -= sc.nextInt();
		n += sc.nextInt();
		System.out.println(n);
		sc.close();
	}
}
```
```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());
		sc.close();
	}
}
```
- - -
###### JavaScript
```js
const [a, b, c] = require("fs").readFileSync("/dev/stdin", "utf8").trim().split(' ').map(Number);
let n = a;
n -= b;
n += c;
console.log(n);
```
```js
const [a, b, c] = require("fs").readFileSync("/dev/stdin", "utf8").trim().split(' ').map(Number);
console.log(a - b + c);
```
- - -
###### Kotlin
```kotlin
fun main() {
	val (a, b, c) = readLine()!!.split(' ').map { it.toInt() }
	var n = a
	n -= b
	n += c
	println(n)
}
```
```kotlin
import java.util.*

fun main() {
	val sc = Scanner(System.`in`)
	println(sc.nextInt() - sc.nextInt() + sc.nextInt())
	sc.close()
}
```
- - -
###### PHP
```php
<?php
	[$a, $b, $c] = array_map("intval", explode(" ", trim(fgets(STDIN))));
	$n = $a;
	$n -= $b;
	$n += $c;
	echo $n, PHP_EOL;
?>
```
```php
<?php
	[$a, $b, $c] = explode(" ", trim(fgets(STDIN)));
	echo $a - $b + $c, PHP_EOL;
?>
```
- - -
###### Perl
```pl
my ($a, $b, $c) = map { int($_) } split ' ', <STDIN>;
my $n = $a;
$n -= $b;
$n += $c;
print "$n$/";
```
```pl
my ($a, $b, $c) = split ' ', <STDIN>;
print $a - $b + $c, $/;
```
- - -
###### Python3
```py
a, b, c = map(int, input().split())
n = a
n -= b
n += c
print(n)
```
```py
a, b, c = map(int, input().split())
print(a - b + c)
```
- - -
###### Ruby
```rb
a, b, c = gets.split.map(&:to_i)
n = a
n -= b
n += c
p n
```
```rb
a, b, c = gets.split.map(&:to_i)
p a - b + c
```
- - -
###### Scala
```scala
import scala.io.StdIn._

object Main extends App{
	val Array(a, b, c) = readLine().split(' ').map(_.toInt)
	var n = a
	n -= b
	n += c
	println(n)
}
```
```scala
import java.util._

object Main extends App{
	val sc = new Scanner(System.in)
	println(sc.nextInt() - sc.nextInt() + sc.nextInt())
	sc.close()
}
```
- - -
###### Swift
```swift
let abc = readLine()!.split(separator: " ").map { Int($0)! }
var n = abc[0]
n -= abc[1]
n += abc[2]
print(n)
```
```swift
let abc = readLine()!.split(separator: " ").compactMap { Int($0) }
let a = abc[0]
let b = abc[1]
let c = abc[2]
print(a - b + c)
```