All pastes #346507 Raw Edit

ravehanker

public text v1 · immutable
·published 2007-02-09 13:03 UTC
rendered paste body
#include <stdio.h>
#include <assert.h>
#include <memory.h>
#include <math.h>

# define PI 3.14159265358979323846

#define	REP(i,n)	for(i=0;i<(n);++i)
#define FOR(i,a,b)	for(i=(a);i<=(b);++i)
#define FORD(i,a,b)	for(i=(a);i>=(b);--i)
#define SET(arr,val)	memset((arr),(val),sizeof(arr))


int main()
{
	int r;
	int first=1;
	while(1) {
		scanf("%d", &r);
		if (r==0) break;
		if(first) first = 0;
		else printf("\n");
		int t;
		scanf("%d", &t);
		int i;
		REP(i, t) {
			int n;
			scanf("%d", &n);
			printf("%d\n", (int)round(2*r*n*sin(PI/n)));
		}
	}
	return 0;
}