Submission #1778613


Source Code Expand

#include "bits/stdc++.h"
using namespace std;
int main()
{
    int n, a, b, c;
    scanf("%d\n%d %d\n%d", &n, &a, &b, &c);
    int d[n];
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &d[i]);
    }
    sort(d, d + n, greater<int>());
    int mx = (int)(c / a);
    for (int i = 1, j = d[0]; i <= n; j += d[i], i++)
    {
        mx = max(mx, (int)((c + j) / (a + b * i)));
    }
    printf("%d\n", mx);
}

Submission Info

Submission Time
Task C - 最高のピザ (Best Pizza)
User ksi
Language C++14 (GCC 5.4.1)
Score 100
Code Size 435 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:6: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:10: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 20 / 20 20 / 20 20 / 20
Status
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
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 AC 1 ms 256 KB
data4 AC 1 ms 256 KB
data5 AC 1 ms 256 KB