結果
問題 | No.1586 Equal Array |
ユーザー | Animesh Bansal |
提出日時 | 2021-07-08 22:28:28 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 14 ms / 1,000 ms |
コード長 | 2,831 bytes |
コンパイル時間 | 1,742 ms |
コンパイル使用メモリ | 172,684 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-01 12:47:18 |
合計ジャッジ時間 | 2,796 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,948 KB |
testcase_04 | AC | 8 ms
6,940 KB |
testcase_05 | AC | 8 ms
6,944 KB |
testcase_06 | AC | 13 ms
6,940 KB |
testcase_07 | AC | 13 ms
6,940 KB |
testcase_08 | AC | 13 ms
6,940 KB |
testcase_09 | AC | 13 ms
6,944 KB |
testcase_10 | AC | 12 ms
6,940 KB |
testcase_11 | AC | 2 ms
6,940 KB |
testcase_12 | AC | 2 ms
6,944 KB |
testcase_13 | AC | 12 ms
6,940 KB |
testcase_14 | AC | 13 ms
6,944 KB |
testcase_15 | AC | 13 ms
6,944 KB |
testcase_16 | AC | 13 ms
6,944 KB |
testcase_17 | AC | 2 ms
6,944 KB |
testcase_18 | AC | 12 ms
6,944 KB |
testcase_19 | AC | 14 ms
6,944 KB |
testcase_20 | AC | 2 ms
6,940 KB |
testcase_21 | AC | 2 ms
6,940 KB |
testcase_22 | AC | 2 ms
6,940 KB |
コンパイルメッセージ
main.cpp: In function 'long long int divisors(long long int)': main.cpp:70:1: warning: no return statement in function returning non-void [-Wreturn-type] 70 | } | ^ main.cpp: In function 'int power(long long int, long long int)': main.cpp:100:1: warning: no return statement in function returning non-void [-Wreturn-type] 100 | } | ^ main.cpp: In function 'bool isprime(int)': main.cpp:51:1: warning: control reaches end of non-void function [-Wreturn-type] 51 | } | ^
ソースコード
#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; }