F - MaratonIME educates( Gym - 101375F )

F - MaratonIME educates

 Gym - 101375F 

Problem Description

Statements

USP has many lunch options between all the uni cafeterias and the restaurants inside the campus. An option that is usually chosen by MaratonIME seniors is the restaurant in the School of Education, for its good prices and free jelly.

The seniors have years of experience weighting on their shoulders, and therefore have tired legs. So they choose to go to the restaurant by car. Trying to save gas, the seniors always minimize the number of cars necessary to take everyone to the restaurant.

The seniors asked you to help them solve their problems. This morning, n cars with seniors arrived in the university, and all of them want to go to the restaurant. Each car holds up to 5people. What is the minimum number of cars necessary to take everyone to the restaurant to "educate"?

Input

On the first line, an integer n, the number of cars. On the second line, n integers a1, ..., an, how many people arrived in each car.

Limits:

  • 1 ≤ n ≤ 105.
  • 1 ≤ ai ≤ 5, for all i.

Output

Print a single integer, the minimum number of cars needed to take everyone to the restaurant.

Examples

Input

3
3 4 5

Output

3

Input

6
1 2 3 4 4 1

Output

3

代码如下:

Hint:这题相对来说比较简单,最重要还是安下心来读题。题目给出一路上的学生数量,要求需要多少辆车来承载这些学生。

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int n, a, sum = 0;
    scanf("%d", &n);
    while(n--)
    {
        scanf("%d", &a);
        sum += a;
    }
    if(sum % 5 == 0)
        printf("%d\n", sum / 5);  // 是5的整数倍,则需要对应车数
    else
        printf("%d\n", sum / 5 + 1);  // 不是5的整数倍则另需要一辆校车
    return 0;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

WMYBlog

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值