Created
September 17, 2013 16:34
-
-
Save joemmanuel/6596898 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 <algorithm> | |
| #include <stdio.h> | |
| using namespace std; | |
| int arr[50]; | |
| int n,i,a,b,c; | |
| int main() | |
| { | |
| scanf("%d",&n); | |
| for (i=0;i<n;i++) | |
| { | |
| scanf("%d",&arr[i]); | |
| } | |
| // Ordernar la entrada | |
| sort(arr,arr+n); | |
| // Determinar A y B como el mínimo y el máximo que vimos | |
| a=arr[0]; | |
| b=arr[n-1]; | |
| // Contar los patos que nos faltan en el intervalo A B | |
| c=(b-a+1)-n; | |
| printf("%d",c); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment