Thursday, March 13, 2014

UVa Solution 10079 : Pizza Cutting


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

int main()
{
    long long pizza, ans=0;
    while(scanf("%lld", &pizza)==1)
    {
        if(pizza<0)
        {
            break;
        }
        ans= ((pizza*(pizza+1))/2)+1;
        printf("%lld\n", ans);
    }
    return 0;
}

No comments:

Post a Comment

Compare equality of two string in C

#include <stdio.h> #include<string.h> int main() {     char* country = "Bangladesh";     char* country2;     ...