728x90
SMALL

using System;

public class Solution {
    public int solution(int chicken) {
        int answer = 0;
        
        for(int i=0;i<6;i++)
        {
            answer += chicken/10;
            chicken = chicken/10 + chicken%10;
        }
        
        return answer;
    }
}

 

 

자바

 

class Solution {
    public int solution(int chicken) {
        int answer = 0;
        
        while (chicken >= 10)
        {
            int service = chicken / 10;
            int nmg = chicken %  10;

            chicken = service + nmg;

            answer += service;

        }

        return answer;
    }
}

 

728x90

설정

트랙백

댓글