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;
    }
  • 相关阅读:
    Run Shell Commands in Python
    在Linux系统上查找文件
    Build a Beautiful oh-my-zsh Themes
    Build VM Cluster on CentOS Host
    色彩学笔记
    Pr PS 笔记
    pthread 笔记
    图片格式
    win DLL 笔记
    XVS 操作
  • 原文地址:https://www.cnblogs.com/A-FM/p/5025533.html
Copyright © 2011-2022 走看看