import java.util.Scanner;

class JAVA51613{

public static void main(String args) {
Scanner stdIn = new Scanner(System.in);

System.out.print("要素数:");
int n = stdIn.nextInt();
int a = new int[n];
int b = new int[n];

for (int i = 0; i < n; i++){
System.out.print("a[" + i + "] = ");
a[i] = stdIn.nextInt();
}

for (int i = 0,j = n-1; i < n; i++,j--)
b[i] = a[j];

System.out.println ("aの全要素を逆順にコピーしました。");

for (int i = 0; i < n; i++)
System.out.println ("b[" + i + "] = " + b[i]);
}
}

 

 

import java.util.Random;
import java.util.Scanner;

class JAVA51614{

public static void main(String args) {
Random rand = new Random();
Scanner stdIn = new Scanner(System.in);
String monthString = {
"January", "February", "March", "April", "May", "June", "July",
"August", "September", "Octorber" , "November" , "December"};
int retry = 0; int tsuki = 13;

System.out.println("英語の月名を入力してください。");
System.out.println("なお、先頭は大文字で、2文字目以降は小文字とします。");
do{
int month = rand.nextInt(12);
if (month == tsuki) continue;
while (true) {
System.out.print ((month + 1) + "月: ");
String m = stdIn.next();

tsuki = month;
if (m.equals(monthString[month])) break;
System.out.println ("違います。" );
} System.out.print ("正解です。もう一度? 1…Yes/0…No :" );
retry = stdIn.nextInt();
} while (retry == 1);
}
}

 

import java.util.Random;
import java.util.Scanner;

class JAVA51615{

public static void main(String args) {
Random rand = new Random();
Scanner stdIn = new Scanner(System.in);
String dayString = {
"sunday", "monday", "tuesday", "wednesday",
"thursday", "friday", "Saturday"};
String
youbiString = {
"日曜日", "月曜日", "火曜日", "水曜日",
"木曜日", "金曜日", "土曜日"};
int retry = 0; int youbi = 8;

System.out.println("英語の曜日名を小文字で入力してください。");

do{
int day = rand.nextInt(7);
if (day == youbi) continue;
while (true) {
System.out.print (youbiString[day] + ":");
String d = stdIn.next();

youbi = day;
if (d.equals(dayString[day])) break;
System.out.println ("違います。" );
} System.out.print ("正解です。もう一度? 1…Yes/0…No :" );
retry = stdIn.nextInt();
} while (retry == 1);
}
}

 

 

 

import java.util.Scanner;

class JAVA51616{

public static void main(String args) {
Scanner stdIn = new Scanner(System.in);

System.out.println("4行3列の行列と3行4列の行列の積をもとめます。");

int a = new int[4][3];
int
b = new int[3][4];
int
c = new int[4][4];

for (int i = 0; i < 4; i++){
for (int j = 0; j < 3; j++){
System.out.print("a[" + i + "][" + j +"] = ");
int n = stdIn.nextInt();
a[i][j] = n;
}
}

for (int i = 0; i < 3; i++){
for (int j = 0; j < 4; j++){
System.out.print("b[" + i + "][" + j +"] = ");
int n = stdIn.nextInt();
b[i][j] = n;
}
}

for (int i = 0; i < 4; i++){
for (int j = 0; j < 4; j++){
int sum = 0;
for(int k = 0; k < 3; k++){
sum += a[i][k]*b[k][j];
}c[i][j] = sum;
}
}

for (int i = 0; i < 4; i++){
for (int j = 0; j < 4; j++){
System.out.print(c[i][j] + " ");
}System.out.println();
}

}
}

 

 

 

import java.util.Scanner;

class JAVA51617{

public static void main(String args) {
Scanner stdIn = new Scanner(System.in);

System.out.println("それぞれの科目の点数を入力してください。");

int a = new int[6][2];
int jap = 0; int math = 0;


for (int i = 0; i < 6; i++){
System.out.println((i+1) + "人目の点数を入力してください。");
System.out.print("国語:");
int n = stdIn.nextInt();
a[i][0] = n;
System.out.print("数学:");
int m = stdIn.nextInt();
a[i][1] = m;
jap += a[i][0]; math += a[i][1];
}

System.out.print("国語の平均点は" + jap / 6 + "です。");
System.out.println("数学の平均点は" + math / 6 + "です。");
for (int i = 0; i < 6; i++){
System.out.println((i+1) + "人目の平均点は" + (a[i][0] + a[i][1])/ 2 +"です。");
}
}
}

 

 

 

class Q52{

public static void main(String args) {

int answer = new int[200];
int kuriage = 0;
int ketasuu = 1;
answer[1] = 1;

for(int n = 2; n <= 100; n++){
for(int j=1; j <= ketasuu; j++){
int num = answer[j] * n + kuriage;
kuriage = num / 10;
answer[j] = num % 10;
if(kuriage > 0 && (j + 1) > ketasuu){
ketasuu++;
}
}
kuriage = 0;

System.out.print(n + "! = ");
for(int i = ketasuu; i > 0; i--){
System.out.print(answer[i]);
}System.out.println();
}
}
}