URAL 1617. Flat Spots

33 篇文章 0 订阅

1617. Flat Spots

Time limit: 0.5 second
Memory limit: 64 MB
Yekaterinburg has an extensive network of tram routes. Trams of more than ten routes go along some streets. It is clear that rails wear out quickly because of such a load. Rails near tram stops sometimes are wavy. Many citizens hold the city authorities responsible for such a poor state of tram railways: repair works are carried out rarely, and even if rails are replaced, it is only by cheapest ones—made of low-grade metal and with wooden ties.
However, not only authorities are guilty of this situation. Some tram drivers are fans of fast driving, and they damage both rails and their trams. If a tram accelerates to a high speed, say 80 kilometers per hour, and then brakes sharply before a stop, it goes some distance skidding. This leads not only to rail spoilage, but also to wearing out wheels at the places where they touch rails. Flat spots emerge on the wheels, which cause pounding of the wheels, rattle of the car, and further rail spoilage.
The administration of the tram depot decided to improve the situation by servicing all trams that have wheels with flat spots. To remove flat spots, wheels will be turned on a special lathe. Wheels from the same pair will be decreased to equal size, but wheels from different pairs may become different in size. To equip a car with wheels, repairmen must choose four wheel pairs with equal wheel diameters.
Repairmen have finished turning all wheels. Some of them have become so small that they can't be used anymore. Such wheels will be sent for remelting. Instead of them, a stock of wheel pairs left from written-off cars can be used. Repairmen have measured all wheel pairs that can be mounted to cars, and now they need to know how many cars can be equipped.

Input

The first line contains the number  n of available wheel pairs (1 ≤  n ≤ 150). In the following  nlines, diameters of wheels in millimeters are given (they are integers in the range from 600 to 700).

Output

Output the number of cars that can be equipped with wheels using the given set of wheel pairs.

Sample

input output
9
689
690
690
689
689
690
689
688
688
1





解析:四个同型号的轮胎可以换一辆车的,问最多能换多少辆车的。

直接扫描计算即可。。。



AC代码:

#include <cstdio>
#include <cstring>
using namespace std;

int a[102];

int main(){
    #ifdef sxk
        freopen("in.txt", "r", stdin);
    #endif //sxk

    int n, foo;
    while(scanf("%d", &n)==1){
        int ans = 0;
        memset(a, 0, sizeof(a));
        for(int i=0; i<n; i++){
            scanf("%d", &foo);
            a[foo - 600] ++;
        }
        for(int i=0; i<=100; i++){
            ans += a[i] / 4;
        }
        printf("%d\n", ans);
    }
    return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值