UVA - 10785 The Mad Numerologist

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char ss[]="JSBKTCLDMVNWFXGPYHQZR";
char s[]="AUEOI";

int cmp(const void* a,const void* b)
{
char* _a=(char*) a;
char* _b=(char*) b;
return *_a-*_b;
}
int main()
{
freopen("a.txt","r",stdin);
char s1[200],s2[200];
int t,n,i,j=1;
scanf("%d",&t);
while(t--)
{
memset(s1,'\0',sizeof(s1));
memset(s2,'\0',sizeof(s2));
printf("Case %d: ",j++);
scanf("%d",&n);
int l1=0,l2=0;
int x=0,y=0;
int c1=0,c2=0;
for(i=0;i<n/2;i++)
{
s1[l1++]=s[x];
s2[l2++]=ss[y];
c1++;c2++;
if(c1==21)
{
c1=0;
x++;
}
if(c2==5)
{
c2=0;
y++;
}
}
if(n/2) s1[l1++]=s[x];
qsort(s1,l1,sizeof(char),cmp);
qsort(s2,l2,sizeof(char),cmp);
for(i=0;i<n/2;i++)
{
printf("%c%c",s1[i],s2[i]);
}
if(n/2) printf("%c",s1[n/2]);
printf("\n");
}
return 0;
}


UVa11565 - Simple Equations
UVa11565 - Simple Equations
41 0
UVa389 - Basically Speaking
UVa389 - Basically Speaking
30 0
|

UVA10474 大理石在哪儿 Where is the Marble?
UVA10474 大理石在哪儿 Where is the Marble?
63 0
UVA - 10474 Where is the Marble
Raju and Meena love to play with Marbles. They have got a lot of marbles with numbers written on them.
1389 0
|

uva 10317 Equating Equations

748 0
|
SQL
uva 10881 - Piotr's Ants

807 0