F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

CodeMaker

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)
Total Submission(s): 344    Accepted Submission(s): 91


Problem Description
Dreamwind is doing C++ homework¡­¡­
¡°Write a program, enter 3 different integers a,b,c, output them in increasing order using their variable names.¡±
This is Dreamwind¡¯s answer:
#include <stdio.h>

int a,b,c;
bool ok;

int main()
{
    printf("Please enter 3 different integers:\n");
    do
    {
      scanf("%d%d%d",&a,&b,&c);
      ok=1;
      if (a==b || a==c || b==c)
        ok=0;
    }while (ok);
    if (a<b)
      if (b<c)
        printf("a<b<c\n");
      else
        if (a<c)
          printf("a<c<b\n");
        else
          printf("c<a<b\n");
    else
      if (a<c)
        printf("b<a<c\n");
      else
        if (b<c)
          printf("b<c<a\n");
        else
          printf("c<b<a\n");
    return 0;
}
Obviously, this program is very complex, but Dreamwind is satisfied with this. He prepares to solve similar question by using the same format. However, when the nubmer of integers if very large, the length of code by this format will be very long, so Dreamwind gives this code to you, hoping you can write a program which can create the code of some questions like ¡°Enter n different integers a,b,c,¡­, output them in increasing order using their variable names.¡± automatically.
We can see that in Dreamwind¡¯s format, the integers¡¯ variable name will be a,b,c,¡­, and when judge whether the integers are different, the ¡°if¡± will follow many sentence like (a==b) in some order. When compare the integers, he uses the least ¡°if¡± so that every ¡°if¡± and ¡°else¡± is perfectly used. For each comparison, a and b will always be used first, and then c, and then d (if n is larger, see the Sample Output). Dreamwind never use ¡°>¡± in this program, and in every ¡°<¡± and ¡°==¡± in the ¡°if¡± sentence, the varible name on the left will always smaller than the one on the right.
 

Input
There are some test cases. For each test case there is only one line with a integer n (2<=n<=8), the number of integers. There is one 0 in the end of the case.
 

Output
For each n, output the code with Dreamwind¡¯s format. Notice that you should use one or more Tabs (¡®\t¡¯) to intent in some lines. Leave a blank line after each output.
 

Sample Input
4 0
 

Sample Output
#include int a,b,c,d; bool ok; int main() { printf("Please enter 4 different integers:\n"); do { scanf("%d%d%d%d",&a,&b,&c,&d); ok=1; if (a==b || a==c || a==d || b==c || b==d || c==d) ok=0; }while (ok); if (a
 

Author
alpc32
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-11 18:36:02, Gzip enabled