# 1256: Nuclear Missile

2016-12-03 12:27:44来源:CSDN作者:Z374012581人点击

### 题目描述

Country Uranux wants to launch its new nuclear missile recently.
There are 3 types of missiles that Uranux has developed successful:
Name: Juno Price per unit: 120millionRange:450kmName:PoseidonPriceperunit:600million Range: 1100km

3
100 2000 500
4
400 400 400 4500
2
1500 4499
1
1000
1
5000

### 样例输出

Case 1:
1 Juno, 1 Poseidon, 1 Apollo. Total cost: 4220million.Case2:3Juno,1Apollo.Totalcost:3860million.
Case 3:
2 Apollo. Total cost: 7000million.Case4:1Poseidon.Totalcost:600million.
Case 5:
Mission impossible!

### 解答

#include<stdio.h>int main(){    int N,a,b,c,d;    long x,n=1;    while(scanf("%d",&N)!=EOF)    {        a=0;b=0;c=0;d=0;        while(N--)        {            scanf("%ld",&x);            if(x<=450) a++;            else if(x<=1100) b++;            else if(x<=4500) c++;            else d++;        }        printf("Case %ld:/n",n);        if(d>0) {printf("Mission impossible!/n");n++;continue;}        if(a>0) N++;        if(b>0) N++;        if(c>0) N++;        if(a>0) {printf("%d Juno",a);N--;if(N>=0) printf(", ");else printf(". ");}        if(b>0) {printf("%d Poseidon",b);N--;if(N>=0) printf(", ");else printf(". ");}        if(c>0) printf("%d Apollo. ",c);        x=a*120+b*600+c*3500;        printf("Total cost: \$%ldmillion./n",x);        n++;    }    return 0;}

无相关信息