paizaラーニングレベルアップ問題集の【算術演算】をやってみた。

paizaラーニングレベルアップ問題集の【算術演算】をやってみました。
- - -
##### 問題
###### 足し算
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__arithmetic_step1
###### 引き算・掛け算
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__arithmetic_step2
###### 割り算
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__arithmetic_step3
###### 掛け算2
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__arithmetic_step4
###### 累乗
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__arithmetic_step5
###### 累乗2
https://paiza.jp/works/mondai/arithmetic_substitution_op/arithmetic_substitution_op__arithmetic_step6
- - -
##### C
###### 足し算
```c
#include <stdio.h>

int main() {
	printf("%d\n", 1231 + 5178);
}
```
###### 引き算・掛け算
```c
#include <stdio.h>

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

const int A = 437326;
const int B = 9085;

int main() {
	printf("%d %d\n", A / B, A % B);
	return 0;
}
```
###### 掛け算2
```c
#include <stdio.h>

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

const int A = 202;
const int B = 134;
const int C = 107;

int main() {
	int n = (A + B) * C;
	printf("%d\n", n * n);
	return 0;
}
```
###### 累乗2
```c
#include <stdio.h>

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

int main() {
	cout << 1231 + 5178 << endl;
	return 0;
}
```
###### 引き算・掛け算
```cpp
#include <iostream>
using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	int d = a - b;
	int p = a * b;
	cout << d << ' ' << p << endl;
	return 0;
}
```
###### 割り算
```cpp
#include <iostream>
using namespace std;

const int A = 437326;
const int B = 9085;

int main() {
	cout << A / B << ' ' << A % B << endl;
	return 0;
}
```
###### 掛け算2
```cpp
#include <iostream>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int x = a * a;
	int y = b * b + c * c;
	cout << x << ' ' << y << endl;
	return 0;
}
```
###### 累乗
```cpp
#include <iostream>
using namespace std;

const int A = 202;
const int B = 134;
const int C = 107;

int main() {
	int n = (A + B) * C;
	cout << n * n << endl;
	return 0;
}
```
###### 累乗2
```cpp
#include <iostream>
using namespace std;

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int n = (a + b) * c;
	cout << n * n % d << endl;
	return 0;
}
```
- - -
##### C#
###### 足し算
```cs
using System;

class Program
{
	public static void Main()
	{
		Console.WriteLine(1231 + 5178);
	}
}
```
###### 引き算・掛け算
```cs
using System;

class Program
{
	public static void Main()
	{
		int[] ab = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int a = ab[0];
		int b = ab[1];
		int d = a - b;
		int p = a * b;
		Console.WriteLine("" + d + ' ' + p);
	}
}
```
###### 割り算
```cs
using System;

class Program
{
	private const int A = 437326;
	private const int B = 9085;

	public static void Main()
	{
		Console.Write(A / B);
		Console.Write(' ');
		Console.Write(A % B);
		Console.WriteLine();
	}
}
```
###### 掛け算2
```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];
		int x = a * a;
		int y = b * b + c * c;
		Console.WriteLine("" + x + ' ' + y);
	}
}
```
###### 累乗
```cs
using System;

class Program
{
	private const int A = 202;
	private const int B = 134;
	private const int C = 107;
	
	public static void Main()
	{
		int n = (A + B) * C;
		Console.WriteLine(n * n);
	}
}
```
###### 累乗2
```cs
using System;

class Program
{
	public static void Main()
	{
		int[] abcd = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int a = abcd[0];
		int b = abcd[1];
		int c = abcd[2];
		int d = abcd[3];
		int n = (a + b) * c;
		Console.WriteLine(n * n % d);
	}
}
- - -
##### Go
###### 足し算
```go
package main
import "fmt"

func main() {
	fmt.Println(1231 + 5178)
}
```
###### 引き算・掛け算
```go
package main
import "fmt"

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	d := a - b
	p := a * b
	fmt.Println(d, p)
}
```
###### 割り算
```go
package main
import "fmt"

const A = 437326
const B = 9085

func main() {
	fmt.Println(A / B, A % B)
}
```
###### 掛け算2
```go
package main
import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	x := a * a
	y := b * b + c * c
	fmt.Println(x, y)
}
```
###### 累乗
```go
package main
import "fmt"

const A = 202;
const B = 134;
const C = 107;

func main() {
	n := (A + B) * C
	fmt.Println(n * n)
}
```
###### 累乗2
```go
package main
import "fmt"

func main() {
	var a, b, c, d int
	fmt.Scan(&a, &b, &c, &d)
	n := (a + b) * c
	fmt.Println(n * n % d)
}
```
- - -
##### Java
###### 足し算
```java
public class Main {
	public static void main(String[] args) {
		System.out.println(1231 + 5178);
	}
}
```
###### 引き算・掛け算
```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();
		sc.close();
		int d = a - b;
		int p = a * b;
		System.out.println("" + d + ' ' + p);
	}
}
```
###### 割り算
```java
public class Main {
	
	private static final int A = 437326;
	private static final int B = 9085;
	
	public static void main(String[] args) {
		System.out.print(A / B);
		System.out.print(' ');
		System.out.print(A % B);
		System.out.println();
	}
}
```
###### 掛け算2
```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();
		int x = a * a;
		int y = b * b + c * c;
		System.out.println("" + x + ' ' + y);
	}
}
```
###### 累乗
```java
public class Main {
	
	private static final int A = 202;
	private static final int B = 134;
	private static final int C = 107;

	public static void main(String[] args) {
		int n = (A + B) * C;
		System.out.println(n * n);
	}
}
```
###### 累乗2
```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();
		int d = sc.nextInt();
		sc.close();
		int n = (a + b) * c;
		System.out.println(n * n % d);
	}
}
```
- - -
##### JavaScript
###### 足し算
```js
console.log(1231 + 5178);
```
###### 引き算・掛け算
```js
const [a, b] = require("fs").readFileSync("/dev/stdin", "utf8").split(' ').map(Number);
const d = a - b
const p = a * b
console.log(d, p);
```
###### 割り算
```js
const A = 437326;
const B = 9085;
console.log(parseInt(A / B), A % B);
```
###### 掛け算2
```js
const [a, b, c] = require("fs").readFileSync("/dev/stdin", "utf8").split(' ').map(Number);
const x = a * a;
const y = b * b + c * c
console.log(x, y);
```
###### 累乗
```js
const A = 202;
const B = 134;
const C = 107;
console.log(((A + B) * C) ** 2);
```
###### 累乗2
```js
const [a, b, c, d] = require("fs").readFileSync("/dev/stdin", "utf8").split(' ').map(Number);
console.log(((a + b) * c) ** 2 % d);
```
- - -
##### Kotlin
###### 足し算
```kotlin
fun main() {
	println(1231 + 5178)
}
```
###### 引き算・掛け算
```kotlin
fun main() {
	val (a, b) = readLine()!!.split(' ').map { it.toInt() }
	val d = a - b
	val p = a * b
	println("" + d + " " + p)
}
```
###### 割り算
```kotlin
val A = 437326;
val B = 9085;

fun main() {
	print(A / B)
	print(' ')
	print(A % B)
	println()
}
```
###### 掛け算2
```kotlin
fun main() {
	val (a, b, c) = readLine()!!.split(' ').map { it.toInt() }
	val x = a * a
	val y = b * b + c * c
	println("" + x + ' ' + y)
}
```
###### 累乗
```kotlin
val A = 202;
val B = 134;
val C = 107;

fun main() {
	val n = (A + B) * C
	println(n * n)
}
```
###### 累乗2
```kotlin
fun main() {
	val (a, b, c, d) = readLine()!!.split(' ').map { it.toInt() }
	val n = (a + b) * c
	println(n * n % d)
}
```
- - -
##### PHP
###### 足し算
```php
<?php
	echo 1231 + 5178, PHP_EOL;
?>
```
###### 引き算・掛け算
```php
<?php
	[$a, $b] = array_map("intval", explode(' ', fgets(STDIN)));
	$d = $a - $b;
	$p = $a * $b;
	echo "$d $p", PHP_EOL;
?>
```
###### 割り算
```php
<?php
	const A = 437326;
	const B = 9085;
	echo intdiv(A, B), ' ', A % B, PHP_EOL;
?>
```
###### 掛け算2
```php
<?php
	[$a, $b, $c] = array_map('intval', explode(' ', fgets(STDIN)));
	$x = $a * $a;
	$y = $b * $b + $c * $c;
	echo "$x $y", PHP_EOL;
?>
```
###### 累乗
```php
<?php
	const A = 202;
	const B = 134;
	const C = 107;
	echo ((A + B) * C) ** 2, PHP_EOL;
?>
```
###### 累乗2
```php
<?php
	[$a, $b, $c, $d] = array_map('intval', explode(' ', fgets(STDIN)));
	echo (($a + $b) * $c) ** 2 % $d, PHP_EOL;
?>
```
- - -
##### Perl
###### 足し算
```pl
print 1231 + 5178, $/;
```
###### 引き算・掛け算
```pl
my ($a, $b) = map { int($_) } split ' ', <STDIN>;
my $d = $a - $b;
my $p = $a * $b;
print "$d $p$/";
```
###### 割り算
```pl
my $A = 437326;
my $B = 9085;
print int($A / $B), ' ', $A % $B, $/;
```
###### 掛け算2
```pl
my ($a, $b, $c) = map { int($_) } split ' ', <STDIN>;
my $x = $a * $a;
my $y = $b * $b + $c * $c;
print "$x $y$/";
```
###### 累乗
```pl
my $A = 202;
my $B = 134;
my $C = 107;
my $n = ($A + $B) * $C;
print $n ** 2, $/;
```
###### 累乗2
```pl
my ($a, $b, $c, $d) = map { int($_) } split ' ', <STDIN>;
my $n = ($a + $b) * $c;
print $n ** 2 % $d, $/;
```
- - -
##### Python3
###### 足し算
```py
print(1231 + 5178)
```
###### 引き算・掛け算
```py
a, b = map(int, input().split())
d = a - b
p = a * b
print(d, p)
```
###### 割り算
```py
A = 437326
B = 9085
print(A // B, A % B)
```
###### 掛け算2
```py
a, b, c = map(int, input().split())
x = a * a
y = b * b + c * c
print(x, y)
```
###### 累乗
```py
A = 202
B = 134
C = 107
print(((A + B) * C) ** 2)
```
###### 累乗2
```py
a, b, c, d = map(int, input().split())
print(((a + b) * c) ** 2 % d)
```
- - -
##### Ruby
###### 足し算
```rb
p 1231 + 5178
```
###### 引き算・掛け算
```rb
a, b = gets.split.map(&:to_i)
d = a - b
p = a * b
print d, ' ', p, "\n"
```
###### 割り算
```rb
A = 437326
B = 9085
print A / B, ' ', A % B, "\n"
```
###### 掛け算2
```rb
a, b, c = gets.split.map(&:to_i)
x = a * a
y = b * b + c * c
print x, ' ', y, "\n"
```
###### 累乗
```rb
A = 202
B = 134
C = 107
p ((A + B) * C) ** 2
```
###### 累乗2
```rb
a, b, c, d = gets.split.map(&:to_i)
p ((a + b) * c) ** 2 % d
```
- - -
##### Scala
###### 足し算
```scala
object Main extends App{
	println(1231 + 5178)
}
```
###### 引き算・掛け算
```scala
import scala.io.StdIn._

object Main extends App{
	val Array(a, b) = readLine().split(' ').map { _.toInt }
	val d = a - b
	val p = a * b
	println("" + d + ' ' + p)
}
```
###### 割り算
```scala
object Main extends App{
	val A = 437326
	val B = 9085
	print(A / B)
	print(' ')
	print(A % B)
	println()
}
```
###### 掛け算2
```scala
import scala.io.StdIn._

object Main extends App{
	val Array(a, b, c) = readLine().split(' ').map { _.toInt }
	val x = a * a
	val y = b * b + c * c
	println("" + x + ' ' + y)
}
```
###### 累乗
```scala
object Main extends App{
	val A = 202
	val B = 134
	val C = 107
	val n = (A + B) * C
	println(n * n)
}
```
###### 累乗2
```scala
import scala.io.StdIn._

object Main extends App{
	val Array(a, b, c, d) = readLine().split(' ').map { _.toInt }
	val n = (a + b) * c
	println(n * n % d)
}
```
- - -
##### Swift
###### 足し算
```swift
print(1231 + 5178)
```
###### 引き算・掛け算
```swift
let ab = readLine()!.split(separator: " ").compactMap { Int($0) }
let (a, b) = (ab[0], ab[1])
let d = a - b
let p = a * b
print(d, p)
```
###### 割り算
```swift
let A = 437326
let B = 9085
print(A / B, A % B)
```
###### 掛け算2
```swift
let abc = readLine()!.split(separator: " ").compactMap { Int($0) }
let (a, b, c) = (abc[0], abc[1], abc[2])
let x = a * a
let y = b * b + c * c
print(x, y)
```
###### 累乗
```swift
let A = 202
let B = 134
let C = 107
let n = (A + B) * C
print(n * n)
```
###### 累乗2
```swift
let abcd = readLine()!.split(separator: " ").compactMap { Int($0) }
let (a, b, c, d) = (abcd[0], abcd[1], abcd[2], abcd[3])
let n = (a + b) * c
print(n * n % d)
```