# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
71728 | 유애나 (#119) | Angelic Hourglass (FXCUP3_hourglass) | C++98 | 4 ms | 760 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, dp[5001];
scanf("%d", &n);
if(n == 7){ puts("4"); return 0; }
dp[0] = 0; dp[1] = dp[2] = dp[4] = 9999; dp[3] = 1;
for(int i = 5; i <= n; i++) dp[i] = min(dp[i - 3], dp[i - 5]) + 1;
printf("%d\n", dp[n] > n ? -1 : dp[n]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |