Bookmark and Share

free counters
Back to the Training Home

Lesson: 18
Problem: 10079
Title: Pizza Cutting
Difficulty Level: 1.5
Date: Jan 25, 2009
Site: UVA

Another easy problem if you can figure out the formula. Take a pen and a piece of paper and try to figure out. If you fail, try to find from this source code:

Solution:

 1 #include<stdio.h>
 2 #include<math.h>
 3 
 4 long long N;
 5 void main() {
 6 	long long  x;
 7 	while(scanf("%lld",&N) == 1) {
 8 		if(N<0) break;
 9         x = N * N + N;
10 		x = x/2 + 1;
11 		printf("%lld\n",x);
12 	}
13 }
Back to the Training Home