Submission

Status:
[PPP][PPP][PPP][PPP][PPPPP]

Score: 100

User: njoop

Problemset: ปราสาท

Language: cpp

Time: 0.002 second

Submitted On: 2024-11-27 00:42:20

#include <bits/stdc++.h>

using namespace std;

int ans;

int main() {
    int n;
    cin >> n;
    if(n == 1) {
        cout << 0;
        return 0;
    }
    for(int i=1; i<=1000; i++) {
        if(n <= i*i) {
            if(i%2 == n%2) ans++;
            cout << ans+2*(i-2)+1;
            return 0;
        }
    }
}