ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > Epoka Science Olympiad 2013-2015 > задача:


2013-11Gr-40. 50317 - Student Line Up

Epoka Science Olympiad 2013-2015

Старт: 18.мая.2013 в 10:00:00
Финиш: 18.мая.2013 в 15:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (2)

Задачи турнира

• 503013 - DNA
• 50958 - ATM
• 2013-10Gr-10. 50310 - Kinetic Energy
• 2013-10Gr-20. 50311 - Student Line Up
• 2013-10Gr-40. 50313 - Pattern Disp...
• 2013-11Gr-10. 50314 - Falling Distance
• 2013-11Gr-20. 50315 - Pig Latin
• 2013-11Gr-30. 50316 - Population B...
• 2013-11Gr-40. 50317 - Student ...
• 2014-10Gr-10. 50424 - Area
• 2014-10Gr-20. 50417 - Fun Fair
• 2014-10Gr-30. 50418 - Student ave...
• 2014-10Gr-40. 50429 - Secret Message
• 2014-11Gr-10. 50430 - ATM
• 2014-11Gr-20. 50420 - Teachers Si...
• 2014-11Gr-30. 50431 - Sultan's Game
• 2015-09Gr-10. 50344 - Profit or Loss

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Prepared by Halil Karimis.

Student Line Up

A teacher has asked all her students to line up single line according to their first name. For example, in one class Amy will be at the front of the line and Yolanda will be at the end.

Question: Write a program that prompts the user to enter the number of students in the class, and then loops to read in that many names. Once all the names have been read in, the program reports the order of the students in the line.

Input specification
The program will get the a number (n) first, and then it gets n names which are all string at most with 16 chars and 1 < n ≤ 100.

Output specification
Print out the order of the students in the class in alphabetical order.

 Sample Run I  
  7
  Sabina
  Beki
  Nilda
  Elton
  Xheni
  Bajram
  Enea

 Sample Output I  
  Bajram
  Beki
  Elton
  Enea
  Nilda
  Sabina
  Xheni

 Sample Input II  
  5
  Yolanda
  Erind
  Amy
  Ardit
  Ledio



 Sample Output II  
  Amy
  Ardit
  Erind
  Ledio
  Yolanda

 Sample Explanation  
"Beki" and "Bajram" both start with 'B' letters, and according to ASCII values "Bajram" is before "Beki".
In C, you can use strcmp (in string.h library) to compare strings.
   int strcmp ( const char * str1, const char * str2 );
In C++, you can compare strings as you compare integers. For example, if name1 and name2 are string variables
   string name1="Beki", name2="Bajram";

when you compare them in your code,
   if(name1 < name2) ...

It will produce false result for the comparision there because "Beki" (according to ASCII values) is greater than "Bajram".


Для отправки решений необходимо выполнить вход.

www.contester.ru