Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit f0ae2b3

Browse files
authored
Add files via upload
1 parent f2a5555 commit f0ae2b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2379
-0
lines changed

ccc/junior/ccc00j1.java

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
package ccc.junior;
2+
import java.io.BufferedReader;
3+
import java.io.IOException;
4+
import java.io.InputStreamReader;
5+
6+
public class ccc00j1 {
7+
public static void main(String[] args) throws IOException {
8+
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
9+
boolean running = true;
10+
11+
String[] input = in.readLine().split(" ");
12+
String[][] numbers = new String[6][7];
13+
14+
int startDay = Integer.parseInt(input[0]);
15+
int endDay = Integer.parseInt(input[1]);
16+
17+
System.out.println("Sun Mon Tue Wed Thr Fri Sat");
18+
19+
int counter = 1;
20+
for (int i = startDay - 1; i < 7; i++) {
21+
numbers[0][i] = Integer.toString(counter);
22+
counter++;
23+
}
24+
25+
for (int i = 1; i < numbers.length; i++) {
26+
if (!running) {
27+
break;
28+
}
29+
for (int j = 0; j < numbers[i].length; j++) {
30+
if (counter > endDay) {
31+
running = false;
32+
break;
33+
}
34+
numbers[i][j] = Integer.toString(counter);
35+
counter++;
36+
}
37+
}
38+
39+
counter = 0;
40+
String dateString;
41+
running = true;
42+
for (int i = 0; i < numbers.length; i++) {
43+
dateString = "";
44+
45+
if (!running) {
46+
break;
47+
}
48+
49+
for (int j = 0; j < numbers[i].length; j++) {
50+
if (numbers[i][j] == null) {
51+
if (counter < endDay) {
52+
dateString += " ";
53+
//dateString += "!!!!";
54+
} else {
55+
running = false;
56+
break;
57+
}
58+
} else {
59+
if (numbers[i][j].length() == 1) {
60+
if (numbers[i][j].equals("1") || j == 0) {
61+
dateString += " " + numbers[i][j];
62+
//dateString += "!!" + numbers[i][j];
63+
} else {
64+
dateString += " " + numbers[i][j];
65+
//dateString += "!!!" + numbers[i][j];
66+
}
67+
} else {
68+
if (j == 0) {
69+
dateString += " " + numbers[i][j];
70+
//dateString += "!" + numbers[i][j];
71+
} else {
72+
dateString += " " + numbers[i][j];
73+
//dateString += "!!" + numbers[i][j];
74+
}
75+
}
76+
}
77+
counter++;
78+
}
79+
dateString.stripTrailing();
80+
dateString.replaceFirst("\\s+$", "");
81+
System.out.println(dateString);
82+
}
83+
}
84+
}

ccc/junior/ccc01j1.java

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package ccc.junior;
2+
import java.io.BufferedReader;
3+
import java.io.IOException;
4+
import java.io.InputStreamReader;
5+
6+
public class ccc01j1 {
7+
8+
public static void main(String[] args) throws NumberFormatException, IOException {
9+
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
10+
11+
int n = Integer.parseInt(in.readLine());
12+
13+
int numStars;
14+
int numSpaces;
15+
for (int i = 0; i < n / 2; i++) {
16+
numStars = (i * 2) + 1;
17+
numSpaces = (n * 2) - (numStars * 2);
18+
19+
for (int j = 0; j < numStars; j++) {
20+
System.out.print("*");
21+
}
22+
23+
for (int j = 0; j < numSpaces; j++) {
24+
System.out.print(" ");
25+
}
26+
27+
for (int j = 0; j < numStars; j++) {
28+
System.out.print("*");
29+
}
30+
System.out.println();
31+
}
32+
33+
for (int i = n / 2; i >= 0; i--) {
34+
numStars = (i * 2) + 1;
35+
numSpaces = (n * 2) - (numStars * 2);
36+
37+
for (int j = 0; j < numStars; j++) {
38+
System.out.print("*");
39+
}
40+
41+
for (int j = 0; j < numSpaces; j++) {
42+
System.out.print(" ");
43+
}
44+
45+
for (int j = 0; j < numStars; j++) {
46+
System.out.print("*");
47+
}
48+
System.out.println();
49+
}
50+
}
51+
}

ccc/junior/ccc01j2.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package ccc.junior;
2+
import java.io.BufferedReader;
3+
import java.io.IOException;
4+
import java.io.InputStreamReader;
5+
6+
public class ccc01j2 {
7+
8+
public static void main(String[] args) throws IOException {
9+
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
10+
11+
boolean isInverse = false;
12+
int m = 1;
13+
14+
int x = Integer.parseInt(in.readLine());
15+
int n = Integer.parseInt(in.readLine());
16+
17+
while (m <= 100) {
18+
if ((m * x) % n == 1) {
19+
isInverse = true;
20+
break;
21+
} else {
22+
m++;
23+
}
24+
}
25+
26+
if (isInverse) {
27+
System.out.println(m);
28+
} else {
29+
System.out.println("No such integer exists.");
30+
}
31+
}
32+
}

ccc/junior/ccc02j1.java

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
package ccc.junior;
2+
import java.io.BufferedReader;
3+
import java.io.IOException;
4+
import java.io.InputStreamReader;
5+
6+
public class ccc02j1 {
7+
public static void main(String[] args) throws IOException {
8+
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
9+
10+
int n = Integer.parseInt(in.readLine());
11+
12+
if (n == 0) {
13+
System.out.println(" * * *");
14+
System.out.println("* *");
15+
System.out.println("* *");
16+
System.out.println("* *");
17+
System.out.println("");
18+
System.out.println("* *");
19+
System.out.println("* *");
20+
System.out.println("* *");
21+
System.out.println(" * * *");
22+
}
23+
else if (n == 1) {
24+
System.out.println("");
25+
System.out.println(" *");
26+
System.out.println(" *");
27+
System.out.println(" *");
28+
System.out.println("");
29+
System.out.println(" *");
30+
System.out.println(" *");
31+
System.out.println(" *");
32+
System.out.println("");
33+
}
34+
else if (n == 2) {
35+
System.out.println(" * * *");
36+
System.out.println(" *");
37+
System.out.println(" *");
38+
System.out.println(" *");
39+
System.out.println(" * * *");
40+
System.out.println("*");
41+
System.out.println("*");
42+
System.out.println("*");
43+
System.out.println(" * * *");
44+
}
45+
else if (n == 3) {
46+
System.out.println(" * * *");
47+
System.out.println(" *");
48+
System.out.println(" *");
49+
System.out.println(" *");
50+
System.out.println(" * * *");
51+
System.out.println(" *");
52+
System.out.println(" *");
53+
System.out.println(" *");
54+
System.out.println(" * * *");
55+
}
56+
else if (n == 4) {
57+
System.out.println("");
58+
System.out.println("* *");
59+
System.out.println("* *");
60+
System.out.println("* *");
61+
System.out.println(" * * *");
62+
System.out.println(" *");
63+
System.out.println(" *");
64+
System.out.println(" *");
65+
System.out.println("");
66+
}
67+
else if (n == 5) {
68+
System.out.println(" * * *");
69+
System.out.println("*");
70+
System.out.println("*");
71+
System.out.println("*");
72+
System.out.println(" * * *");
73+
System.out.println(" *");
74+
System.out.println(" *");
75+
System.out.println(" *");
76+
System.out.println(" * * *");
77+
}
78+
else if (n == 6) {
79+
System.out.println(" * * *");
80+
System.out.println("*");
81+
System.out.println("*");
82+
System.out.println("*");
83+
System.out.println(" * * *");
84+
System.out.println("* *");
85+
System.out.println("* *");
86+
System.out.println("* *");
87+
System.out.println(" * * *");
88+
}
89+
else if (n == 7) {
90+
System.out.println(" * * *");
91+
System.out.println(" *");
92+
System.out.println(" *");
93+
System.out.println(" *");
94+
System.out.println("");
95+
System.out.println(" *");
96+
System.out.println(" *");
97+
System.out.println(" *");
98+
System.out.println("");
99+
}
100+
else if (n == 8) {
101+
System.out.println(" * * *");
102+
System.out.println("* *");
103+
System.out.println("* *");
104+
System.out.println("* *");
105+
System.out.println(" * * *");
106+
System.out.println("* *");
107+
System.out.println("* *");
108+
System.out.println("* *");
109+
System.out.println(" * * *");
110+
}
111+
else if (n == 9) {
112+
System.out.println(" * * *");
113+
System.out.println("* *");
114+
System.out.println("* *");
115+
System.out.println("* *");
116+
System.out.println(" * * *");
117+
System.out.println(" *");
118+
System.out.println(" *");
119+
System.out.println(" *");
120+
System.out.println(" * * *");
121+
}
122+
}
123+
}

ccc/junior/ccc02j2.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package ccc.junior;
2+
import java.io.*;
3+
4+
public class ccc02j2 {
5+
public static void main(String[] args) throws IOException {
6+
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
7+
String str;
8+
String strOr;
9+
String letterBeforeOr;
10+
int length;
11+
12+
do {
13+
str = in.readLine().toLowerCase();
14+
if (str.equals("quit!")) {
15+
break;
16+
}
17+
18+
length = str.length();
19+
try {
20+
strOr = str.substring(length - 2, length);
21+
letterBeforeOr = str.substring(length - 3, length - 2);
22+
if (strOr.equals("or") && length >= 4 && (!letterBeforeOr.equals("a") && !letterBeforeOr.equals("e") && !letterBeforeOr.equals("i") && !letterBeforeOr.equals("o") && !letterBeforeOr.equals("u") && !letterBeforeOr.equals("y"))) {
23+
str = str.substring(0, length - 1) + "ur";
24+
}
25+
} catch (Exception e) {
26+
}
27+
28+
System.out.println(str);
29+
30+
} while (!str.equals("quit!"));
31+
}
32+
}

ccc/junior/ccc03j1.java

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package ccc.junior;
2+
import java.io.BufferedReader;
3+
import java.io.IOException;
4+
import java.io.InputStreamReader;
5+
6+
public class ccc03j1 {
7+
8+
public static void main(String[] args) throws NumberFormatException, IOException {
9+
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
10+
11+
int tineLength = Integer.parseInt(in.readLine());
12+
int tineSpace = Integer.parseInt(in.readLine());
13+
int handleLength = Integer.parseInt(in.readLine());
14+
15+
for (int i = 0; i < tineLength; i++) {
16+
System.out.print("*");
17+
18+
for (int j = 0; j < tineSpace; j++) {
19+
System.out.print(" ");
20+
}
21+
22+
System.out.print("*");
23+
24+
for (int j = 0; j < tineSpace; j++) {
25+
System.out.print(" ");
26+
}
27+
28+
System.out.println("*");
29+
}
30+
31+
int bladeLength = (tineSpace * 2) + 3;
32+
33+
for (int i = 0; i < bladeLength; i++) {
34+
System.out.print("*");
35+
}
36+
System.out.println();
37+
38+
for (int i = 0; i < handleLength; i++) {
39+
for (int j = 0; j < bladeLength / 2; j++) {
40+
System.out.print(" ");
41+
}
42+
System.out.println("*");
43+
}
44+
}
45+
}

ccc/junior/ccc04j1.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package ccc.junior;
2+
import java.util.Scanner;
3+
4+
public class ccc04j1 {
5+
public static void main(String[] args) {
6+
Scanner in = new Scanner(System.in);
7+
int num = in.nextInt();
8+
int result = (int) Math.floor(Math.sqrt(num));
9+
10+
System.out.println("The largest square has side length " + result + ".");
11+
in.close();
12+
13+
}
14+
}

0 commit comments

Comments
 (0)