Created
August 24, 2021 01:17
-
-
Save esthicodes/592f9036e26448914419f202fff590c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n,p,j=0,a[100000]; | |
scanf("%d",&n); | |
scanf("%d",&p); | |
for (int i=0;i<=n;i++) | |
if (i%2==0) | |
{ | |
j++; | |
a[i]=j; | |
a[i+1]=j; | |
} | |
if (a[p]-1<j-a[p]) printf("%d",a[p]-1); | |
else printf("%d",j-a[p]); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment