답안 #71669

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
71669 2018-08-25T10:42:33 Z team(#2232, comfile) 천사의 모래시계 (FXCUP3_hourglass) C++
100 / 100
3 ms 624 KB
#include <bits/stdc++.h>
#define INF 100000000
using namespace std;
int main(){
    int n;scanf("%d",&n);
    int ans=INF;
    int i=0;
    while(1){
        if((5*i)>n) break;
        if(!((n-5*i)%3)){
            ans=min(ans,i+(n-5*i)/3);
        }
        i++;
    }
    i=0;
     while(1){
        if((5*i)>n-7) break;
        if(!((n-7-5*i)%3)){
            ans=min(ans,i+(n-7-5*i)/3+4);
        }
        i++;
    }
    if(ans>=INF) ans=-1;
    printf("%d\n",ans);
    return 0;
}

Compilation message

hourglass.cpp: In function 'int main()':
hourglass.cpp:5:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int n;scanf("%d",&n);
           ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 416 KB Output is correct
2 Correct 3 ms 416 KB Output is correct
3 Correct 3 ms 396 KB Output is correct
4 Correct 3 ms 416 KB Output is correct
5 Correct 2 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 624 KB Output is correct
2 Correct 2 ms 572 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 2 ms 624 KB Output is correct
5 Correct 2 ms 624 KB Output is correct
6 Correct 3 ms 624 KB Output is correct
7 Correct 2 ms 492 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 2 ms 624 KB Output is correct
10 Correct 3 ms 572 KB Output is correct
11 Correct 2 ms 492 KB Output is correct
12 Correct 3 ms 624 KB Output is correct
13 Correct 2 ms 624 KB Output is correct
14 Correct 2 ms 572 KB Output is correct
15 Correct 3 ms 624 KB Output is correct
16 Correct 3 ms 624 KB Output is correct
17 Correct 2 ms 572 KB Output is correct
18 Correct 2 ms 624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 624 KB Output is correct
2 Correct 2 ms 624 KB Output is correct
3 Correct 2 ms 624 KB Output is correct
4 Correct 2 ms 624 KB Output is correct
5 Correct 2 ms 624 KB Output is correct
6 Correct 3 ms 624 KB Output is correct
7 Correct 3 ms 624 KB Output is correct
8 Correct 2 ms 624 KB Output is correct
9 Correct 3 ms 624 KB Output is correct
10 Correct 2 ms 624 KB Output is correct
11 Correct 3 ms 624 KB Output is correct
12 Correct 2 ms 624 KB Output is correct