Tuesday, February 25, 2014

UVa 10079 - Pizza Cutting solution

Problem link :  UVa 10079 - Pizza Cutting

Solution : 


#include<stdio.h>
int main()
{
    long long int a,n;
    while(scanf("%lld",&n)==1)
    {
        if(n<0)
            break;
        a=1+((n*(n+1))/2);
        printf("%lld\n",a);
    }
    return 0;
}




No comments:

Post a Comment