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
|
public class Main {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int five = 0;
int three = 0;
while(N%5!=0&&N>=0){
N-=3;
three++;
}
if(N<0){
System.out.println(-1);
}
else{
five = N/5;
System.out.println(five+three);
}
}
}
|
'Algorithm > BOJ 기초' 카테고리의 다른 글
[백준] 수들의합 1789 Python C++ (0) | 2019.10.02 |
---|---|
[백준] 소인수분해 11653 Python C++ (0) | 2019.10.02 |
[백준] 문자열 반복 2675 C++ (0) | 2019.10.02 |
[백준] 화성수학 5355 C++ (0) | 2019.09.30 |
[백준] 스택수열 1874 Python (0) | 2019.09.28 |