• nullnullhdu2304(最多插口)


    查了好多资料,发现还是不全,干脆自己整理吧,至少保证在我的做法正确的,以免误导读者,也是给自己做个记录吧!

     

    Problem Description
    Roy has just moved into a new apartment. Well, actually the apartment itself is not very new, even dating back to the days before people had electricity in their houses. Because of this, Roy's apartment has only one single wall outlet, so Roy can only power one of his electrical appliances at a time.
    Roy likes to watch TV as he works on his computer, and to listen to his HiFi system (on high volume) while he vacuums, so using just the single outlet is not an option. Actually, he wants to have all his appliances connected to a powered outlet, all the time. The answer, of course, is power strips, and Roy has some old ones that he used in his old apartment. However, that apartment had many more wall outlets, so he is not sure whether his power strips will provide him with enough outlets now.
    Your task is to help Roy compute how many appliances he can provide with electricity, given a set of power strips. Note that without any power strips, Roy can power one single appliance through the wall outlet. Also, remember that a power strip has to be powered itself to be of any use.

        

     

        

    Input
        每日一道理
    爱心是一片照射在冬日的阳光,使贫病交迫的人感到人间的温暖;爱心是一泓出现在沙漠里的泉水,使濒临绝境的人重新看到生活的希望;爱心是一首飘荡在夜空的歌谣,使孤苦无依的人获得心灵的慰藉。

        

    Input will start with a single integer 1 <= N <= 20, indicating the number of test cases to follow. Then follow N lines, each describing a test case. Each test case starts with an integer 1 <= K <= 10, indicating the number of power strips in the test case. Then follow, on the same line, K integers separated by single spaces, O1 O2 . . . OK, where 2 <= Oi <= 10, indicating the number of outlets in each power strip.

        

     

        

    Output

        

    Output one line per test case, with the maximum number of appliances that can be powered.

        

     

        

    Sample Input
    3 3 2 3 4 10 4 4 4 4 4 4 4 4 4 4 4 10 10 10 10
     

        

    Sample Output
    7 31 37
    #include<stdio.h>
    int main()
    {
        int t,n,i,a[15],m,sum;
        scanf("%d",&t);
        while(t--)
        {
            scanf("%d",&n);
            sum=0;
            for(i=0;i<n;i++)
            {
                 scanf("%d",&a[i]);
                 sum+=a[i];
            }
    
            m=n-1;
            sum-=m;
            printf("%d\n",sum);
        }
        return 0;
    }

        
     

    文章结束给大家分享下程序员的一些笑话语录: 与女友分手两月有余,精神萎靡,面带菜色。家人介绍一女孩,昨日与其相亲。女孩果然漂亮,一向吝啬的我决定破例请她吃晚饭。
    选了一个蛮贵的西餐厅,点了比较贵的菜。女孩眉开眼笑,与我谈得很投机。聊着聊着,她说:“我给你讲个笑话吧。”“ok”
      “一只螳螂要给一只雌蝴蝶介绍对象,见面时发现对方是只雄蜘蛛。见面后螳螂问蝴蝶‘如何?’,‘他长的太难看了’,‘别看人家长的丑,人家还有网站呢’。”
      “呵呵………”我笑。忽然她问:“你有网站吗?”  

  • 相关阅读:
    HookLogger的使用
    文件创建与读写练习
    存储流练习2
    闭包
    Console命令详解,让调试js代码变得更简单
    清除浮动的3种方法
    js继承的几种实现方法
    题一
    题二
    十个修复IE6下bug技巧
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3087230.html
Copyright © 2020-2023  润新知