본문 바로가기
알고리즘 & 자료구조/백준

백준 2839

by 신재권 2021. 8. 3.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main2839 {

	public static void main(String[] args) throws IOException{
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(bf.readLine());
		int cnt = 0;
		
		while(true){
			if(N%5 == 0){
				cnt += N/5;
				break;
			}
			N -= 3;
			cnt++;
			
			if(N < 0){
				cnt = -1;
				break;
			}
		}
		System.out.println(cnt);
		
		
	}

}

'알고리즘 & 자료구조 > 백준' 카테고리의 다른 글

백준 10953  (0) 2021.08.04
백준 10828  (0) 2021.08.04
백준 2775  (0) 2021.07.28
백준 2750  (0) 2021.07.28
백준 10250  (0) 2021.07.22