Submission #20231

#TimeUsernameProblemLanguageResultExecution timeMemory
20231kgy5809앱 (KOI13_app)C11
0 / 21
2 ms0 KiB
#include <stdio.h> int m[100], c[100]; int N, M; void main() { int i, j, t; int dp[10000] = { 0 }; scanf("%d%d", &N, &M); for (i = 0; i<N; scanf("%d", m + i++)); for (i = 0; i<N; scanf("%d", c + i++)); for (t = i = 0; i<N; i++)t += c[i]; for (i = 0; i<N; i++) { for (j = t; j >= c[i]; j--) { if (dp[j]<dp[j - c[i]] + m[i]) { dp[j] = dp[j - c[i]] + m[i]; } } } for (i = 0; i <= t; i++) { if (dp[i] >= M)break; } printf("%d", i); }

Compilation message (stderr)

app.c:6:6: warning: return type of 'main' is not 'int' [-Wmain]
 void main()
      ^
app.c: In function 'main':
app.c:10:4: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d%d", &N, &M);
    ^
app.c:11:21: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
    for (i = 0; i<N; scanf("%d", m + i++));
                     ^
app.c:12:21: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
    for (i = 0; i<N; scanf("%d", c + i++));
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...