URAL 1617. Flat Spots

來源:互聯網
上載者:User

標籤:

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.InputThe 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).OutputOutput the number of cars that can be equipped with wheels using the given set of wheel pairs.Sample
input output
9689690690689689690689688688
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;}


URAL 1617. Flat Spots

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.