consider some square matrix < Span class= "Tex-span" > A with side n consisting of Zeros and Ones. There Are n rows numbered From 1 to n from top to bottom and n Columns numbered From 1 to n from left To the This matrix. We ' ll denote the element of the matrix which is located at the intersection of The i - Row and The J -th column As A i , J .
let's Call Matrix a clear if no, cells containing ones have A common side .
let's Call Matrix A symmetrical if it matches the matrices formed from it By a horizontal and/or a vertical reflection. Formally, for each pair ( i , J ) (1≤ I , j ≤ n ) both of the following conditions must be Met: A i , j = A n - i + 1, J and A i , j = A i , n - J + 1.
Let's define the sharpness of matrix A as the number of ones in it.
Given integer x, your task is to find the smallest positive integer n such that there exists a C Lear symmetrical matrix A with side n and sharpness x.
Input
The only line contains a single integer x (1≤ x ≤100)-the required sharpness of the matrix.< /c3>
Output
Print a single number-the sought value of n.
Sample Test (s)input
4
Output
3
input
9
OUTPU5given a matrix of several definitions (shape, cleanliness, uniformity), each time an x is given to satisfy the n*n matrix of the shape X, neatness, uniformity, the smallest nyy, you can know that n is even when the optimal solution must not be. When n is odd: if x is within [l,r], N is the smallest of the a[x] rows, then the smallest of n is a[x]+2 in the range [r+1,r+ (a[x]+1) * *].1 to 5, then 6~100 will be able to push a bit.
1#include <cstdio>2 3 Const intmaxn= the;4 5 intA[MAXN];6 7 intMain ()8 {9a[1]=1;Tena[3]=5; Onea[2]=a[4]=a[5]=3; A for(intI=5;i<MAXN;) - { - intX= (a[i]+1)*2; the for(intj=i+1; j<=i+x;j++) -a[j]=a[i]+2; -i+=x; - } + - intx; + while(SCANF ("%d", &x)! =EOF) A { atprintf"%d\n", a[x]); - } - - return 0; - -}View Code
Note
The figure below shows the matrices, correspond to the samples:
Codeforces 201A Clear symmetry