class Solution {
public int solution(int n, int k) {
int answer = 0;
answer = n*12000+k*2000-n/10*2000;
return answer;
}
}
class Solution {
public int solution(int n) {
int answer = 0;
if(n%7==0){
answer = n/7;
}else{
answer = n/7 + 1;
}
return answer;
}
}
class Solution {
public int solution(int slice, int n) {
int answer = 0;
if(n%slice == 0){
answer = n / slice;
}else{
answer = n / slice + 1;
}
return answer;
}
}
class Solution {
public int solution(int[] dot) {
int answer = 0;
if(dot[0] > 0 && dot[1] > 0){
answer = 1;
}else if(dot[0] < 0 && dot[1] > 0){
answer = 2;
}else if(dot[0] < 0 && dot[1] < 0){
answer = 3;
}else{
answer=4;
}
return answer;
}
}
class Solution {
public int[] solution(int money) {
int[] answer = new int[2];
answer[0] = money / 5500;
answer[1] = money % 5500;
return answer;
}
}
class Solution {
public int solution(int price) {
int answer = 0;
if(price >= 500000){
answer = (int)(price*0.8);
}else if(price >= 300000){
answer = (int)(price*0.9);
}else if(price >= 100000){
answer = (int)(price*0.95);
}else{
answer = price;
}
return answer;
}
}
class Solution {
public int solution(int n) {
int answer = 0;
for(int i=0; i<= 1000; i++) {
if(i*i == n )
return answer = 1;
}
return answer = 2;
}
}
✏️ 제곱수 판별하기는 생각하는 데 꽤 시간이 걸렸다. 다른 분들은 Math.sqrt()라는
함수를 써서 구현하셔서 그런 함수가 있다는 걸 알게되었다.
Math.sqrt(n)은 n의 제곱근을 구해주는 함수다. 입력값과 출력값 모두 double형이다.