Submission #1777893
Source Code Expand
#include "bits/stdc++.h" using namespace std; int n, a, b, c, d[100]; vector<int> price; bool dp[100][100][1010000]; void calc(int num, int count, int cal) { if (count >= n) { price.push_back((int)((cal + c) / (num * b + a))); } else { if (!dp[num][count + 1][cal]) { calc(num, count + 1, cal); dp[num][count + 1][cal] = true; } if (!dp[num + 1][count + 1][cal + d[count]]) { calc(num + 1, count + 1, cal + d[count]); dp[num + 1][count + 1][cal + d[count]] = true; } } } int main() { scanf("%d\n%d %d\n%d", &n, &a, &b, &c); for (int i = 0; i < n; i++) { scanf("%d", &d[i]); } calc(0, 0, 0); sort(price.begin(), price.end(), greater<int>()); printf("%d\n", price[0]); }
Submission Info
Submission Time | |
---|---|
Task | C - 最高のピザ (Best Pizza) |
User | ksi |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 875 Byte |
Status | CE |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:28:43: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d\n%d %d\n%d", &n, &a, &b, &c); ^ ./Main.cpp:31:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &d[i]); ^ /tmp/ccUcOCLo.o: In function `calc(int, int, int)': Main.cpp:(.text+0x18): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccUcOCLo.o Main.cpp:(.text+0x55): relocation truncated to fit: R_X86_64_32S against symbol `d' defined in .bss section in /tmp/ccUcOCLo.o Main.cpp:(.text+0x9c): relocation truncated to fit: R_X86_64_32S against symbol `d' defined in .bss section in /tmp/ccUcOCLo.o Main.cpp:(.text+0xdb): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /t...