Submission #1777833
Source Code Expand
#include "bits/stdc++.h"
using namespace std;
int n, a, b, c, d[100];
vector<int> price;
void calc(int num, int count, int cal)
{
if (count >= n)
{
price.push_back((int)((cal + c) / (num * b + a)));
}
else
{
calc(num, count + 1, cal);
calc(num + 1, count + 1, cal + d[count]);
}
}
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 |
40 |
Code Size |
596 Byte |
Status |
RE |
Exec Time |
7461 ms |
Memory |
256 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:19: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:22:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &d[i]);
^
Judge Result
Set Name |
set01 |
set02 |
set03 |
set04 |
set05 |
Score / Max Score |
20 / 20 |
20 / 20 |
0 / 20 |
0 / 20 |
0 / 20 |
Status |
|
|
|
|
|
Set Name |
Test Cases |
set01 |
data1 |
set02 |
data2 |
set03 |
data3 |
set04 |
data4 |
set05 |
data5 |
Case Name |
Status |
Exec Time |
Memory |
data1 |
AC |
1 ms |
256 KB |
data2 |
AC |
1 ms |
256 KB |
data3 |
RE |
7461 ms |
-2096312 KB |
data4 |
RE |
6696 ms |
-2095672 KB |
data5 |
RE |
6340 ms |
-2095156 KB |