Skip to content

Instantly share code, notes, and snippets.

@luckypapa
Created August 30, 2015 06:53
Show Gist options
  • Save luckypapa/414e95b76e53feb83128 to your computer and use it in GitHub Desktop.
Save luckypapa/414e95b76e53feb83128 to your computer and use it in GitHub Desktop.
//https://www.acmicpc.net/problem/3059
#include <stdio.h>
#define TOTAL_UPPER_ASCI 2015
int getSumOfNoneChar(void) {
int data[26] = { 0 };
int sum = TOTAL_UPPER_ASCI;
char temp[1000] = { 0 };
scanf("%s", temp);
for (int i = 0; temp[i] != '\0'; i ++) {
data[temp[i] - 'A'] += 1;
}
for (int i = 0; i < 26; i++) {
if (data[i] != 0)
sum -= ('A' + i);
}
return sum;
}
int main(void) {
int T;
scanf("%d", &T);
while(T--) {
printf("%d\n", getSumOfNoneChar());
}
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment