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; }
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; }
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; }
vector<int> searchRange(vector<int>& nums, int target) { int l = findL(nums, target), r = findR(nums, target); return {l, r}; }