#include #include int main() { char boxes[26] = {"ZYXWVUTSRQPONMLKJIHGFEDCBA"}; for (int repeat=20000000; repeat>0; repeat--) { for (int lightestBoxNum=0; lightestBoxNum<25; lightestBoxNum++) { for (int compareBox=lightestBoxNum + 1; compareBox<26; compareBox++) { char leftWeight = boxes[lightestBoxNum]; char rightWeight = boxes[compareBox]; if ((repeat & 1) == 0) { if (rightWeight < leftWeight) { boxes[lightestBoxNum] = rightWeight; boxes[compareBox] = leftWeight; } } else { if (rightWeight > leftWeight) { boxes[lightestBoxNum] = rightWeight; boxes[compareBox] = leftWeight; } } } } } /*for (int i=0; i<26; i++) printf("%c", boxes[i]); printf("\n");*/ }