Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
Tags
- 문제풀이
- oracle
- BFS
- 시뮬레이션
- 운동기록
- 자바
- 백준
- 문제해결
- DP
- greedy
- binary search
- dfs
- 건강
- 프로그래머스
- math
- 이분탐색
- priorityqueue
- db
- Java
- 코딩테스트
- SWEA
- BOJ
- 코테
- SQL
- COS PRO
- 투포인터
- 알고리즘
- 문자열
- 러닝일지
- MySQL
Archives
- Today
- Total
슈콩
[SWEA] 정곤이의 단조 증가하는 수 본문

[문제]
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWcPjEuKAFgDFAU4
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
[소스 코드]
import java.util.*;
import java.io.*;
public class Solution {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
int T = Integer.parseInt(br.readLine());
for(int tc=1;tc<=T;tc++) {
int n = Integer.parseInt(br.readLine());
st = new StringTokenizer(br.readLine());
int[] nums = new int[n];
for(int i=0;i<n;i++) {
nums[i] = Integer.parseInt(st.nextToken());
}
Queue<Integer> q = new LinkedList<>();
for(int i=0;i<n;i++) {
for(int j=i+1;j<n;j++) {
q.offer(nums[i]*nums[j]);
}
}
int result = -1;
while(!q.isEmpty()) {
int origin = q.poll();
int target = origin;
boolean check = false;
while(target>0) {
int cmp = target % 10;
target /= 10;
if(cmp < (target%10)) {
check = true;
break;
}
}
if(!check) {
result = Math.max(result, origin);
}
}
System.out.println("#"+tc+" "+result);
}
}
}'Algorithms > SWEA' 카테고리의 다른 글
| [SWEA] 숫자 조각 (0) | 2025.11.12 |
|---|---|
| [SWEA] 8일차 - 암호문1 (0) | 2025.11.11 |
| [SWEA] 교환학생 (0) | 2025.11.11 |
| [SWEA] 10일차 - 비밀번호 (0) | 2025.11.10 |
| [SWEA] 규영이와 인영이의 카드게임 (0) | 2025.11.10 |