๋ชฉ์ฐจ
[ # 2ํ์ฐจ ์ ๋ณด ]
- 2024๋ 7์ 16์ผ 19:00 - 22:00
- Discord ์์ ํตํ๋ก ์จ๋ผ์ธ ์คํฐ๋ ํ์ ์งํ
[ # 2ํ์ฐจ ๊ฐ์ธ ๋ชฉํ ]
Java ๋ฐฑ์ค ๋ฌธ์ ํ์ด ์งํ
- ๋ธ๋ก ์ฆ 1 28358๋ฒ
- ์ค๋ฒ 5 28345๋ฒ
[ # 2ํ์ฐจ ๊ฐ์ธ ํ๋ ๋ด์ฉ ]
28358๋ฒ: ์์ผ ๋ง์ถ๊ธฐ
https://www.acmicpc.net/problem/28358
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringTokenizer st;
int T=Integer.parseInt(br.readLine());
for(int i=0; i<T; i++) {
int c=0;
int count31=0;
int count30=0;
int countzero =0;
int count=0;
int[]Number=new int[10];
List<Integer> A = new ArrayList<>();
st=new StringTokenizer(br.readLine());
for(int j=0; j<10; j++) {
Number[j]=Integer.parseInt(st.nextToken());
}
for(int j=1; j<10; j++) {
if(Number[j]==0) {
for(int a=0; a<10; a++) {
if(Number[a]==0) {
c=Integer.parseInt(""+j+a);
if(c<=31) {
A.add(c);
if(c==31) {
count31+=1;
}
else if(c==30) {
count30+=1;
}
}
}
}
}
}
c=0;
for(int j=0; j<10; j++) {
if(Number[j]==0) {
c+=1;
}
}
if(Number[0]==0) {
countzero =1;
}
for(int j=1; j<10; j++) {
if(Number[j]==0) {
if(j==1 || j==3 || j==5 || j==7 || j==8) {
count+=A.size();
count+=c-countzero;
}
else if(j==2) {
count+=A.size()-count30-count31;
count+=c-countzero;
}
else {
count+=A.size()-count31;
count+=c-countzero;
}
}
}
if(Number[0]==0 && Number[1]==0) {
count+=A.size();
count+=c-countzero;
}
if(Number[2]==0 && Number[1]==0) {
count+=A.size();
count+=c-countzero;
}
if(Number[1]==0) {
count+=A.size()-count31;
count+=c-countzero;
}
bw.write(count+"\n");
}
bw.flush();
bw.close();
}
}
28345๋ฒ: Image Filter
https://www.acmicpc.net/problem/28345
import java.io.*;
import java.util.*;
public class Main {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
static StringTokenizer st;
static int[][]RC;
static int R;
static int C;
public static void main(String[] args) throws NumberFormatException, IOException {
int T=Integer.parseInt(br.readLine());
for(int i=0; i<T; i++) {
input();
int F[]=new int [5];
for(int a=0; a<R; a++ ) {
for(int b=0; b<C; b++) {
F[0]=RC[a][b]-f0(a,b);
F[1]=RC[a][b]-f1(a,b);
F[2]=RC[a][b]-f2(a,b);
F[3]=RC[a][b]-f3(a,b);
F[4]=RC[a][b]-f4(a,b);
int qqq=F[0];
int Q=0;
for(int j=1; j<5; j++) {
if(Math.abs(qqq)>Math.abs(F[j])) {
qqq=F[j];
Q=j;
}
}
bw.write(Q+" "+qqq+" ");
}
bw.write("\n");
}
}
bw.flush();
bw.close();
}
static void input() throws NumberFormatException, IOException {
st=new StringTokenizer(br.readLine());
R=Integer.parseInt(st.nextToken());
C=Integer.parseInt(st.nextToken());
RC=new int[R][C];
for(int r=0; r<R; r++) {
st=new StringTokenizer(br.readLine());
for(int c=0; c<C; c++) {
RC[r][c]=Integer.parseInt(st.nextToken());
}
}
}
static int f0(int r, int c) {
return 0;
}
static int f1(int r, int c) {
if(c-1<0) {
return 0;
}
else {
return RC[r][c-1];
}
}
static int f2(int r, int c) {
if(r-1<0) {
return 0;
}
else {
return RC[r-1][c];
}
}
static int f3(int r, int c) {
return (f1(r,c)+f2(r,c))/2;
}
static int f4(int r, int c) {
if(r-1<0 ||c-1<0) {
return 0;
}
else {
return (f1(r,c)+f2(r,c)-RC[r-1][c-1]);
}
}
}
'๐ ๊ฐ์ธ ํ๋ ๋ชจ์์ง ๐ > ๐ฉ๐ปโ๐ป `24 ํ๊ณ ๋ชจ๊ฐ์ฝ ๐ฉ๐ปโ๐ป' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 6ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.30 |
---|---|
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 5ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.28 |
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 4ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.26 |
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 3ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.26 |
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 1ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.14 |
[ # 2ํ์ฐจ ์ ๋ณด ]
- 2024๋ 7์ 16์ผ 19:00 - 22:00
- Discord ์์ ํตํ๋ก ์จ๋ผ์ธ ์คํฐ๋ ํ์ ์งํ
[ # 2ํ์ฐจ ๊ฐ์ธ ๋ชฉํ ]
Java ๋ฐฑ์ค ๋ฌธ์ ํ์ด ์งํ
- ๋ธ๋ก ์ฆ 1 28358๋ฒ
- ์ค๋ฒ 5 28345๋ฒ
[ # 2ํ์ฐจ ๊ฐ์ธ ํ๋ ๋ด์ฉ ]
28358๋ฒ: ์์ผ ๋ง์ถ๊ธฐ
https://www.acmicpc.net/problem/28358
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); StringTokenizer st; int T=Integer.parseInt(br.readLine()); for(int i=0; i<T; i++) { int c=0; int count31=0; int count30=0; int countzero =0; int count=0; int[]Number=new int[10]; List<Integer> A = new ArrayList<>(); st=new StringTokenizer(br.readLine()); for(int j=0; j<10; j++) { Number[j]=Integer.parseInt(st.nextToken()); } for(int j=1; j<10; j++) { if(Number[j]==0) { for(int a=0; a<10; a++) { if(Number[a]==0) { c=Integer.parseInt(""+j+a); if(c<=31) { A.add(c); if(c==31) { count31+=1; } else if(c==30) { count30+=1; } } } } } } c=0; for(int j=0; j<10; j++) { if(Number[j]==0) { c+=1; } } if(Number[0]==0) { countzero =1; } for(int j=1; j<10; j++) { if(Number[j]==0) { if(j==1 || j==3 || j==5 || j==7 || j==8) { count+=A.size(); count+=c-countzero; } else if(j==2) { count+=A.size()-count30-count31; count+=c-countzero; } else { count+=A.size()-count31; count+=c-countzero; } } } if(Number[0]==0 && Number[1]==0) { count+=A.size(); count+=c-countzero; } if(Number[2]==0 && Number[1]==0) { count+=A.size(); count+=c-countzero; } if(Number[1]==0) { count+=A.size()-count31; count+=c-countzero; } bw.write(count+"\n"); } bw.flush(); bw.close(); } }
28345๋ฒ: Image Filter
https://www.acmicpc.net/problem/28345
import java.io.*; import java.util.*; public class Main { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); static StringTokenizer st; static int[][]RC; static int R; static int C; public static void main(String[] args) throws NumberFormatException, IOException { int T=Integer.parseInt(br.readLine()); for(int i=0; i<T; i++) { input(); int F[]=new int [5]; for(int a=0; a<R; a++ ) { for(int b=0; b<C; b++) { F[0]=RC[a][b]-f0(a,b); F[1]=RC[a][b]-f1(a,b); F[2]=RC[a][b]-f2(a,b); F[3]=RC[a][b]-f3(a,b); F[4]=RC[a][b]-f4(a,b); int qqq=F[0]; int Q=0; for(int j=1; j<5; j++) { if(Math.abs(qqq)>Math.abs(F[j])) { qqq=F[j]; Q=j; } } bw.write(Q+" "+qqq+" "); } bw.write("\n"); } } bw.flush(); bw.close(); } static void input() throws NumberFormatException, IOException { st=new StringTokenizer(br.readLine()); R=Integer.parseInt(st.nextToken()); C=Integer.parseInt(st.nextToken()); RC=new int[R][C]; for(int r=0; r<R; r++) { st=new StringTokenizer(br.readLine()); for(int c=0; c<C; c++) { RC[r][c]=Integer.parseInt(st.nextToken()); } } } static int f0(int r, int c) { return 0; } static int f1(int r, int c) { if(c-1<0) { return 0; } else { return RC[r][c-1]; } } static int f2(int r, int c) { if(r-1<0) { return 0; } else { return RC[r-1][c]; } } static int f3(int r, int c) { return (f1(r,c)+f2(r,c))/2; } static int f4(int r, int c) { if(r-1<0 ||c-1<0) { return 0; } else { return (f1(r,c)+f2(r,c)-RC[r-1][c-1]); } } }
'๐ ๊ฐ์ธ ํ๋ ๋ชจ์์ง ๐ > ๐ฉ๐ปโ๐ป `24 ํ๊ณ ๋ชจ๊ฐ์ฝ ๐ฉ๐ปโ๐ป' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 6ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.30 |
---|---|
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 5ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.28 |
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 4ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.26 |
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 3ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.26 |
[`24 ํ๊ณ ๋ชจ๊ฐ์ฝ] ํ ๋ฆฌ์ปจ์ ์ฌ๊ณ 1ํ์ฐจ ๊ฐ์ธ ๋ฆฌ๋ทฐ (0) | 2024.07.14 |