Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- long long c;
- cin >>c;
- long long l = 0, r = c, m = (l + r) /2;
- while (abs(c - (pow(m, 2) + pow(m, 0.5))) < 0.000001){
- m = (l + r) / 2;
- cout << "yeye";
- if (pow(m, 2) + pow(m, 0.5) < c){
- l = m;
- }
- else {
- if (pow(m, 2) + pow(m, 0.5) > c) {
- r = m;
- }
- }
- }
- cout << m;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement