結果

問題 No.1586 Equal Array
ユーザー Animesh BansalAnimesh Bansal
提出日時 2021-07-08 22:28:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 13 ms / 1,000 ms
コード長 2,831 bytes
コンパイル時間 1,518 ms
コンパイル使用メモリ 172,632 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 05:06:49
合計ジャッジ時間 2,759 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 8 ms
4,376 KB
testcase_05 AC 8 ms
4,376 KB
testcase_06 AC 13 ms
4,380 KB
testcase_07 AC 13 ms
4,376 KB
testcase_08 AC 13 ms
4,380 KB
testcase_09 AC 13 ms
4,376 KB
testcase_10 AC 12 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 12 ms
4,376 KB
testcase_14 AC 12 ms
4,376 KB
testcase_15 AC 12 ms
4,380 KB
testcase_16 AC 12 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 12 ms
4,376 KB
testcase_19 AC 13 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘long long int divisors(long long int)’ 内:
main.cpp:70:1: 警告: 非 void を戻す関数内に return 文がありません [-Wreturn-type]
   70 | }
      | ^
main.cpp: 関数 ‘int power(long long int, long long int)’ 内:
main.cpp:100:1: 警告: 非 void を戻す関数内に return 文がありません [-Wreturn-type]
  100 | }
      | ^
main.cpp: 関数 ‘bool isprime(int)’ 内:
main.cpp:51:1: 警告: 制御が非 void 関数の終りに到達しました [-Wreturn-type]
   51 | }
      | ^

ソースコード

diff #

#include<bits/stdc++.h>
#define ll              long long
#define rep(i,x,y)      for(i=x;i<y;i++)
#define  f              first
#define s               second
#define pb              push_back
using namespace std;

ll  i,j,c=0,x=1,y=1,r=0,result=0,ans=1,temp=0,sum=1,a,b,e,f,g,h,d,n,m,t,cont=1e9+7;
string  str,str1,str2,s1,s2,s3=" ";
vector<ll> v,v1,v2;
map<string, int> mp;
//GCD of two number using Euclidean Algorithm
//Time Complexity=O(log(min(a,b))

ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}

//a*b=gcd(a,b)*lcm(a,b)
//Fastest Way of Finding LCM

ll lcm(ll a,ll b)
{

    return a*b/gcd(a,b);
}

//This is also funtion of finding prime numbers but time complexity
//is more.
//Time Complixity: O(n^3/2)

bool isprime(int n)
{
    if(n==1)
        return 0;
    if(n==2||n==3)
        return 1;
    if(n%2==0 || n%3==0)
        return 0;
    for(ll i=5; i*i<=n; i+=6)
    {
        if(n%i==0 || n%(i+2)==0)
            return 0;
        return 1;
    }
}


ll divisors(ll n)
{
    ll i;
    rep(i,1,sqrt(n))
    {
        if (n%i == 0)
        {
            // If divisors are equal, print only one
            if (n/i == i)
                cout<<i<<" ";

            else // Otherwise print both
                cout<<i<<" "<<n/i<<" ";
        }

    }
}
//Sieve of Eratosthenes
//it will print all the prime numbers
//Time Complexity :O(log log n)
void sieve (int n)
{
    vector<bool>isprime(n+1,true );
    {
        for(i=2; i<=n; i++)
        {
            if(isprime[i])
            {
                cout<<i<<" ";
                for(j=i*i; j<=n; j+=i)
                {
                    isprime[j]=false;
                }
            }
        }

    }
}
int power(ll n,ll m)
{

    for(i=0; i<m; i++)
    {
        sum=sum*n;
    }
    cout<<sum;
}
//calculating the Power of the number using itreative
//Time Complexity O(log n)
//Space Complexity O(1)
ll powe(ll n, ll m)
{
    while(m>0)
    {
        if(m&1)
            ans*=n;
        n*=n;
        m=m>>1;
    }
    return ans;
}
int power(long long x, unsigned int y, int p)
{
    int res = 1;     // Initialize result

    x = x % p; // Update x if it is more than or
    // equal to p

    if (x == 0) return 0; // In case x is divisible by p;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}
/****************    MAINCODE   *************************/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> t;
    c=0;
    d=t;
    while(t--)
    {
        cin >> b;
        c+=b;
    }
    if(c%d==0)
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
}

0