Submission #6362881
Source Code Expand
#include<stdio.h> #include<stdlib.h> #include<stdint.h> #include<inttypes.h> typedef int32_t i32; #define ALLOC(size,type) ((type*)calloc((size),sizeof(type))) void run (void) { i32 n; scanf ("%" SCNi32, &n); i32 m = 100 * n; uint8_t *dp = ALLOC (m + 1, uint8_t); dp[0] = 1; while (n--) { i32 p; scanf ("%" SCNi32, &p); for (i32 i = m; i >= p; --i) { dp[i] |= dp[i - p]; } } i32 ans = 0; for (i32 i = 0; i <= m; ++i) { ans += dp[i]; } printf ("%" PRIi32 "\n", ans); } int main (void) { run(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - コンテスト |
User | sansen |
Language | C (GCC 5.4.1) |
Score | 2 |
Code Size | 592 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.c: In function ‘run’: ./Main.c:12:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf ("%" SCNi32, &n); ^ ./Main.c:18:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf ("%" SCNi32, &p); ^
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 2 / 2 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00, 01, 02, 90, 91 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00 | AC | 1 ms | 128 KB |
01 | AC | 1 ms | 128 KB |
02 | AC | 1 ms | 128 KB |
90 | AC | 1 ms | 128 KB |
91 | AC | 1 ms | 128 KB |