Created
March 12, 2014 00:27
-
-
Save fferegrino/9498143 to your computer and use it in GitHub Desktop.
1284 - Last Digit
This file contains 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 <cstring> | |
#include <stdio.h> | |
#define S 25 | |
using namespace std; | |
int main(){ | |
char cad[1000001]; | |
char c; | |
int cub[S]; | |
while(scanf("%s",cad) != EOF){ | |
int len = strlen(cad); | |
long long int res = 0; | |
for(int i = 0; i < len; i++){ | |
cub[cad[i] - 'a']++; | |
} | |
for(int i = 0; i < S; i++){ | |
res = // Combinatoria de cub[i] en len | |
len -= cub[i]; | |
} | |
printf("%lld\n", res); // Ultimo digito de res | |
memset(cub,0,S*sizeof(char)); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment