hdu4505 小Q系列故事——电梯里的爱情

模拟,下楼梯不用停。

 1 #include <iostream>
 2 #include <stdio.h>
 3 #include <cmath>
 4 #include <string.h>
 5 using namespace std;
 6 int step[100+10];
 7 int main()
 8 {
 9     int c;
10     int n,i,j,cnt,maxstep;
11     int temp;
12     while(~scanf("%d",&c))
13     {
14         while(c--)
15         {
16             scanf("%d",&n);
17             cnt=0;
18             maxstep=0;
19             for(i=0;i<105;++i)
20                 step[i]=0;
21             for(i=0;i<n;++i)
22             {
23                 scanf("%d",&temp);
24                 step[temp]++;
25                 if(temp>maxstep)
26                 {
27                     maxstep=temp;
28                 }
29             }
30             for(i=1;i<=maxstep;++i)
31             {
32                 cnt+=6;
33                 if(step[i])
34                     cnt+=5;
35                 cnt+=step[i];
36             }
37             cnt+=maxstep*4;
38             printf("%d\n",cnt);
39         }
40     }
41     return 0;
42 }

 

posted on 2013-03-22 19:07 symons 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/symons1992/archive/2013/03/22/2976216.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值