-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10785.cpp
More file actions
60 lines (56 loc) · 888 Bytes
/
10785.cpp
File metadata and controls
60 lines (56 loc) · 888 Bytes
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
#include<stdio.h>
/* The Mad Numerologist - 10785 */
main(){
int i,j,k,l,c,n,t,cv,cc;
char nome[211],vogais[6]={"AUEOI"},consoantes[22]={"JSBKTCLDMVNWFXGPYHQZR"};
scanf("%d",&c);
for(i=1;i<=c;i++)
{
scanf("%d",&n);
t=n;
printf("Case %d: ",i);
j=k=l=cv=cc=0;
while(n!=0)
{
if(cv==21)
{
k++;
cv=0;
}
nome[j]=vogais[k];
cv++;
j++;
n--;
if(n==0)
break;
if(cc==5)
{
l++;
cc=0;
}
nome[j]=consoantes[l];
cc++;
j++;
n--;
}
for(k=0;k<t-2;k+=2)
for(l=k+2;l<t;l+=2)
if(nome[k]>nome[l])
{
nome[k]^=nome[l];
nome[l]^=nome[k];
nome[k]^=nome[l];
}
for(k=1;k<t-2;k+=2)
for(l=k+2;l<t;l+=2)
if(nome[k]>nome[l])
{
nome[k]^=nome[l];
nome[l]^=nome[k];
nome[k]^=nome[l];
}
for(n=0;n<t;n++)
printf("%c",nome[n]);
printf("\n");
}
}