Submission #160509

#TimeUsernameProblemLanguageResultExecution timeMemory
160509tushar_2658Brunhilda’s Birthday (BOI13_brunhilda)C++14
0 / 100
1087 ms1020 KiB
#include "bits/stdc++.h" using namespace std; const int maxn = 10005; int a[maxn], dp[maxn], n, m; int solve(int x){ for(int i = 0; i < maxn; i++){ dp[i] = 1e8; } dp[0] = 0; for(int i = 1; i <= x; i++){ for(int j = 1; j <= n; j++){ dp[i] = min(dp[i], 1 + dp[i - (i % a[j])]); } } return dp[x]; } int main(int argc, char const *argv[]) { // freopen("in.txt", "r", stdin); scanf("%d %d", &n, &m); for(int i = 1; i <= n; i++){ scanf("%d", &a[i]); } int x; scanf("%d", &x); solve(x); printf("%d\n", dp[x]); return 0; }

Compilation message (stderr)

brunhilda.cpp: In function 'int main(int, const char**)':
brunhilda.cpp:23:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m); 
     ~~~~~^~~~~~~~~~~~~~~~~
brunhilda.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &a[i]);
         ~~~~~^~~~~~~~~~~~~
brunhilda.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &x); 
     ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...