-
Notifications
You must be signed in to change notification settings - Fork 0
/
badprank.cpp
79 lines (76 loc) · 1.53 KB
/
badprank.cpp
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include <stdio.h>
#include <string.h>
char convertCharacter(char arr[])
{
switch (arr[])
{
case '0':
return 'o';
case '1':
return 'I';
case '3':
return 'E';
case '4':
return 'A';
case '5':
return 'S';
case '6':
return 'G';
case '7':
return 'T';
case '8':
return 'B';
default:
return arr[];
}
}
int main()
{
long long tc;
long long shift[26];
char capital[1005];
long long size;
FILE *fp = fopen("testdata.in", "r");
fscanf(fp, "%lld", &tc);
fgetc(fp);
for (int i = 0; i < tc; i++)
{
fscanf(fp, "%lld", &shift);
fgetc(fp);
while (!feof(fp))
{
fscanf(fp, "%c", &capital[i]);
size++;
}
convertCharacter(capital);
fgetc(fp);
printf("Case #%d: ", i + 1);
int c[26] = {0};
int d[26] = {0};
int j = 0;
while (X[j] != '\0')
{
int z = X[j] - 65;
d[z]++;
j++;
c[j]++;
}
for (int i = 0; i < 26; i++)
{
if (d[i] > 0)
{
int shiftAmount = shift[i] % 26;
char shiftedChar = X[i] - shiftAmount;
if (shiftedChar < 'A')
{
shiftedChar += 26;
}
printf("%c %d\n", shiftedChar, d[i]);
d[i] = 0;
}
}
}
fclose(fp);
return 0;
}
// je ne sais pas