Browse Source

Add 'K.cpp'

webturing 4 years ago
parent
commit
7ffd298535
1 changed files with 11 additions and 0 deletions
  1. 11 0
      K.cpp

+ 11 - 0
K.cpp

@@ -0,0 +1,11 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main(){
+    int n;cin>>n;
+    int m=sqrt(n);
+    int left=m*m,right=(m+1)*(m+1);
+    if(m-left<right-m)cout<<left<<endl;
+    else cout<<right<<endl;
+     
+    return 0;
+}