All pastes #346968 Raw Edit

ravehanker

public text v1 · immutable
·published 2007-02-09 14:12 UTC
rendered paste body
#include <stdio.h>
#include <math.h>

#define PI 3.14159265358979323846

int main()
{
	int first=1;
	int  r;
	int n;
	int t;
	int i;

	while(1) {
		scanf("%d", &r);
		if (r==0) break;
		if(first) first = 0;
		else printf("\n");

		scanf("%d", &t);
		for (i=0; i<t; ++i) {
			scanf("%d", &n);
			printf("%d\n", (int)ceil(2*r*n*sin(PI/n)));
		}
	}
	return 0;
}