zoukankan      html  css  js  c++  java
  • ______________________1205_______________________能不用数组就不用数组吧...

    同一题在是用数组和不使用数组的时候在是用数组的时候 数组开得太大导致内存太大,数组开得太小导致访问越界,所以精良不开数组.并且以后在写程序的时候养成用__int64的好习惯..........尽量少犯那些操蛋而又让人无能为力的错...下面附上正确代码

    #include<stdio.h>
    __int64 max(__int64 q,__int64 y);
    int main()
    {
        __int64 a,n,t;
        scanf("%I64d",&t);
        while(t--)
        {
            static __int64 x,s;
            x=s=0;
        //    printf("********%I64d****%I64d*******",x,s);
            scanf("%I64d",&n);
            while(n--)
            {
                scanf("%I64d",&a);
                s=s+a;
                x=max(x,a);
            }
            s=s-x;
            if((s+1)>=x)
                printf("Yes
    ");
            else
                printf("No
    ");
        }
        return 0;
    }
    __int64 max(__int64 q,__int64 y)
    {
        if(q>y)
            return q;
        else
            return y;
    }
  • 相关阅读:
    delphi算法
    delphi 弹出选择目录窗口
    delphi 导出xml文件
    play 源码分析
    oracle指令
    delphi 环境问题
    如何启动redis
    关于整理和工作小结
    如何强制关闭服务
    delphi之事件
  • 原文地址:https://www.cnblogs.com/A-FM/p/5025533.html
Copyright © 2011-2022 走看看