📑 개인 활동 모음집 📑/👩🏻💻 `24 하계 모각코 👩🏻💻
[`24 하계 모각코] 펠리컨적 사고 4회차 개인 리뷰
lrycro_
2024. 7. 26. 14:48
[ # 4회차 정보 ]
- 2024년 7월 23일 19:00 - 22:00
- Discord 영상 통화로 온라인 스터디 회의 진행
[ # 4회차 개인 목표 ]
Java 백준 문제 풀이 진행
- 실버 5 28238번
- 실버 5 28345번
[ # 4회차 개인 활동 내용 ]
28238번: 정보 선생님의 야망
https://www.acmicpc.net/problem/28238
import java.util.*;
import java.io.*;
public class Main {
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter bw= new BufferedWriter(new OutputStreamWriter(System.out));
static StringTokenizer st;
public static void main(String[] args) throws NumberFormatException, IOException {
int N=Integer.parseInt(br.readLine());
int Plan[][]=new int[N][5];
for(int i=0; i<N; i++) {
String SSS=br.readLine();
st=new StringTokenizer(SSS);
for(int j=0; j<5; j++) {
Plan[i][j]=Integer.parseInt(st.nextToken());
}
}
int x=1;
int y=2;
int[]QQQ=new int[5];
int A[][]= new int[5][5];
for(int i=0; i<N; i++) {
if(Plan[i][0]==1 && Plan[i][1]==1) {
A[0][1]+=1;
}
if(Plan[i][0]==1 && Plan[i][2]==1) {
A[0][2]+=1;
}
if(Plan[i][0]==1 && Plan[i][3]==1) {
A[0][3]+=1;
}
if(Plan[i][0]==1 && Plan[i][4]==1) {
A[0][4]+=1;
}
if(Plan[i][1]==1 && Plan[i][2]==1) {
A[1][2]+=1;
}
if(Plan[i][1]==1 && Plan[i][3]==1) {
A[1][3]+=1;
}
if(Plan[i][1]==1 && Plan[i][4]==1) {
A[1][4]+=1;
}
if(Plan[i][2]==1 && Plan[i][3]==1) {
A[2][3]+=1;
}
if(Plan[i][2]==1 && Plan[i][4]==1) {
A[2][4]+=1;
}
if(Plan[i][3]==1 && Plan[i][4]==1) {
A[3][4]+=1;
}
}
int count=0;
for(int i=0; i<5; i++) {
for(int j=0; j<5; j++) {
if(count<A[i][j]) {
count=A[i][j];
x=i;
y=j;
}
}
}
QQQ[x]=1;
QQQ[y]=1;
bw.write(count+"\n");
for(int i=0; i<5; i++) {
bw.write(QQQ[i]+" ");
}
bw.flush();
bw.close();
}
}
27674번: A+B
https://www.acmicpc.net/problem/27674
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));
public static void main(String[] args) throws NumberFormatException, IOException {
int t=Integer.parseInt(br.readLine());
long EEE=0;
for(int i=0; i<t; i++) {
int WW[]=new int[2];
String Q="";
int A[]=new int[10];
String SSS=br.readLine();
SSS=br.readLine();
for(int j=0; j<SSS.length(); j++) {
String AA="";
AA+=SSS.charAt(j);
A[Integer.parseInt(AA)]+=1;
}
int P=0;
for(int j=0; j<10; j++) {
for(int a=A[j]; a>0; a-- ) {
A[j]-=1;
WW[P]=j;
P+=1;
if(P>=1) {
EEE=j;
break;
}
}
if(P>=1) {
break;
}
}
for(int j=9; j>=0; j--) {
for(int a=A[j]; a>0; a-- ) {
Q+=j;
}
}
long AAAA=WW[0];
long QQQ=Long.parseLong(Q);
QQQ+=AAAA;
bw.write(QQQ+"\n");
}
bw.flush();
bw.close();
br.close();
}
}