-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1168.c
36 lines (31 loc) · 823 Bytes
/
1168.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdio.h>
int main(void) {
int a;
scanf("%d", &a);
getchar();
while (a--) {
int i, leds = 0;
char num[1001];
fgets(num, 1000, stdin);
for (i = 0; num[i] != '\n'; i++) {
switch (num[i]) {
case '1':
leds += 2; break;
case '2': case '3': case '5':
leds += 5; break;
case '4':
leds += 4; break;
case '6': case '9': case '0':
leds += 6; break;
case '7':
leds += 3; break;
case '8':
leds += 7; break;
default:
continue;
}
}
printf("%d leds\n", leds);
}
return 0;
}