답안 :
import java.util.Arrays;
public class Solution {
public int solution(int number, int limit, int power) {
int answer = 0;
int Factors[] = new int[number];
int Factorscnt = 0;
boolean limitflag[] = new boolean[number];
Arrays.fill(limitflag, true);
for (int i = 1; i <= Factors.length; i++) {
for (int j = 1; j * j <= i; j++) {
if (j * j == i) {
Factorscnt++;
} else if (i % j == 0) {
Factorscnt += 2;
}
}
Factors[i - 1] = Factorscnt;
Factorscnt = 0;
if (Factors[i - 1] > limit) {
limitflag[i - 1] = false;
}
if (limitflag[i - 1]) {
answer += Factors[i - 1];
} else {
answer += power;
}
}
return answer;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Solution s = new Solution();
int number = 5;
int limit = 3;
int power = 2;
System.out.println(s.solution(number, limit, power));
}
}
int count = 0;
for (int i = 1; i <= N; i++) {
if (N % i == 0) count++;
}
int count = 0;
for (int i = 1; i * i <= N; i++) {
if (i * i == N) count++;
else if (N % i == 0) count += 2;
}

답안 :
SELECT Year(o1.SALES_DATE) as 'YEAR',
month(o1.SALES_DATE) as 'MONTH' ,
u1.GENDER, count(Distinct u1.USER_ID) as 'USERS'
from USER_INFO u1
left join ONLINE_SALE o1
on u1.USER_ID = o1.USER_ID
where u1.GENDER is not null AND Year(o1.SALES_DATE) is not null AND month(o1.SALES_DATE) is not null
group by 1,2,3
order by 1,2,3
SELECT Year(o1.SALES_DATE) as 'YEAR',
month(o1.SALES_DATE) as 'MONTH' ,
u1.GENDER, count(Distinct u1.USER_ID) as 'USERS'
from USER_INFO u1
Inner join ONLINE_SALE o1
on u1.USER_ID = o1.USER_ID
where u1.GENDER is not null
group by 1,2,3
order by 1,2,3
답안 :
SELECT r1.REST_ID , r1.REST_NAME,r1.FOOD_TYPE ,r1.FAVORITES, r1.ADDRESS,ROUND(avg(r2.REVIEW_SCORE),2) as 'SCORE'
from REST_INFO r1
inner join REST_REVIEW r2
on r1.REST_ID=r2.REST_ID
where substr(r1.ADDRESS,1,2) ='서울'
group by 1
order by 6 desc,4 desc