UVA 10785 (暑假-排序、检索(2)-E-The Mad Numerologist )
2014-07-26 14:23
411 查看
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <algorithm> using namespace std; int main() { char sound[] = {"AUEOI"}; char consonant[] = {"JSBKTCLDMVNWFXGPYHQZR"}; int t, k = 0; scanf("%d", &t); while (k++ < t) { printf("Case %d: ", k); int n; scanf("%d", &n); int sorted_sound[250]; int sorted_consonant[250]; int j = 0, l = 0; for (int i = 0; i < n; i++) { if (i%2 == 0) sorted_sound[j++] = sound[i/42]; else sorted_consonant[l++] = consonant[i/10]; } sort(sorted_sound,sorted_sound + j); sort(sorted_consonant,sorted_consonant + l); int count_1 = 0; int count_2 = 0; for (int i = 0; i < n; i++) { if (i%2 == 0) printf("%c", sorted_sound[count_1++]); else printf("%c", sorted_consonant[count_2++]); } printf("\n"); } return 0; }
相关文章推荐
- 排序检索-10785 - The Mad Numerologist
- UVa 10785 The Mad Numerologist (排序)
- UVA - 10785 The Mad Numerologist
- UVA 10785 - The Mad Numerologist
- uva 10785 The Mad Numerologist(遍历+sort排序)
- UVa10785 The Mad Numerologist
- UVa 10785 - The Mad Numerologist
- UVa 10785 - The Mad Numerologist
- UVa 10785 - The Mad Numerologist
- uva 10785 The Mad Numerologist
- uva 10785 - The Mad Numerologist
- Uva 10785 - The Mad Numerologist
- UVa 10785 - The Mad Numerologist
- UVA 10785 The Mad Numerologist
- uva 10785 - The Mad Numerologist
- uva 10785 - The Mad Numerologist
- Uva 10785 - The Mad Numerologist
- uva 10785 The Mad Numerologist
- UVA 10785 The Mad Numerologist
- The Mad Numerologist UVA-10785 第五章