Saturday, March 29, 2014

codechef March Cook-Off 2014 Dividing Stamps solution

codechef March Cook-Off 2014 Dividing Stamps: http://www.codechef.com/COOK44/problems/DIVIDING , http://www.codechef.com/problems/DIVIDING

codechef March Cook-Off 2014 Dividing Stamps editorial: http://discuss.codechef.com/questions/40353/dividing-editorial

codechef March Cook-Off 2014 Dividing Stamps solution: http://ideone.com/HuRk2m


#include <iostream>
#include <cstdio>
using namespace std;

int main() {
 long long int n, a, cnt;
 cnt=0;
 scanf("%lld", &n);
 for(int i=0; i<n; i++) scanf("%lld", &a), cnt+=a;
 if(n*(n+1)/2==cnt) printf("YES\n");
 else printf("NO\n");
 return 0;
}

No comments:

Post a Comment