Advertisement
Josif_tepe

Untitled

Mar 22nd, 2024
415
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <map>
  4. #include <set>
  5. using namespace std;
  6. typedef long long ll;
  7.  
  8.  
  9.  
  10. int main() {
  11.     ll n;
  12.     cin >> n;
  13.     int res = 0;
  14.     for(ll i = 1; i <= n; i++) {
  15.         if(i * i < n) {
  16.             res++;
  17.         }
  18.         else {
  19.             break;
  20.         }
  21.     }
  22.     cout << res << endl;
  23.     return 0;
  24. }
  25.  
Advertisement
Comments
  • Aera223
    244 days
    # C++ 0.30 KB | 0 0
    1. #include <stdio.h>
    2. //Fixed SQRT, example: 10000 gives 100, not 99
    3. int main() {
    4.     int n = 10000;
    5.     int res = 0;
    6.     for(int i = 1; i <= n; i++) {
    7.         if(i * i <= n) {
    8.             res++;
    9.         }
    10.         else {
    11.             break;
    12.         }
    13.     }
    14.     printf("%u",res);
    15.     return 0;
    16. }
Add Comment
Please, Sign In to add comment
Advertisement