예제 #1
0
void problem(CmdLine& cmdLine)
{
	cout.precision(20);
	double angle=0;
	for(double angInc = 1; angInc > 0.000000001; angInc *= 0.1)
		angle = findMaxR(angle, angInc);

	cout << "answer=" << 2*asin(1.) * findR(angle) * findR(angle) << endl;

	cout << "answer2=" << (2*asin(1.)*pow(20., 2.)/9.81) * pow(100. + pow(20.,2.)/(9.81*2.), 2.) << endl;


	return;

	int num;
	do
	{
		cout << "Angle: ";
		num = 0;
		cin >> num;
		if(num >= 0)
			findR(num);
	}while(num >= 0);

//	cout << "r=" << findR(0) << endl;
//	cout << "Answer=" << endl;
}
예제 #2
0
double findMaxR(double angStart, double angInc)
{
	double rPrev;

	double rCurr  = findR(angStart);
	do
	{
		rPrev = rCurr;
		angStart += angInc;
		rCurr = findR(angStart);
	}while(rPrev < rCurr);

	return angStart - angInc*2;
}
예제 #3
0
파일: 2999.cpp 프로젝트: kkd927/baekjoon
int main()
{
	while (scanf("%s", str) != EOF)
	{
		N = strlen(str);
		R = findR(N);
		C = N / R;

		int k = 0;
		for (int i = 0; i < C; i++)
			for (int j = 0; j < R; j++)
				arr[j][i] = str[k++];

		for (int i = 0; i < R; i++)
			for (int j = 0; j < C; j++)
				printf("%c", arr[i][j]);

		printf("\n");

		memset(str, 0, sizeof(str));
		memset(arr, 0, sizeof(arr));
	}
	return 0;
}
예제 #4
0
파일: 34.cpp 프로젝트: CC91/LeetCode
 vector<int> searchRange(vector<int>& nums, int target) {
     int l = findL(nums, target), r = findR(nums, target);
     return {l, r};
 }