Skip to content

Instantly share code, notes, and snippets.

@fferegrino
Created March 12, 2014 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fferegrino/9498143 to your computer and use it in GitHub Desktop.
Save fferegrino/9498143 to your computer and use it in GitHub Desktop.
1284 - Last Digit
#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