¿ì¼± ÀÌ·± ¹®Á¦Àä. ÀúÈñ Çб³¿¡¼´Â OJ ½Ã½ºÅÛÀ̶ó´Â º°µµÀÇ È¨ÆäÀÌÁö¿¡ °¡¼ ½Ç½À¹®Á¦³ª °úÁ¦¸¦ Á¦ÃâÇÑ ÈÄ 0Á¡~100Á¡ »çÀÌ¿¡¼ º»ÀÎÀÇ Á¡¼ö¸¦ ¾Ë·ÁÁÝ´Ï´Ù.
±×·±µ¥ Àú´Â ÀÚ²Ù 90Á¡¹Û¿¡ ³ª¿ÀÁö ¾Ê³×¿ä. ÀÌ°Ç ¾ÆÁÖ ¹Ì¹¦ÇÑ ¹ö±×°¡ ÀÖ´Ù´Â °Çµ¥ ãÁú ¸øÇϰڽÀ´Ï´Ù¤Ð¤Ð
Á¦°¡ § ÄÚµå´Â ¾Æ·¡¿¡ ÀÖ½À´Ï´Ù. ¾î¶°ÇÑ ºÎºÐÀÌ À߸øµÈ°ÇÁö ÈùÆ®³ª ÁöÀûÀ» ÇØ ÁÖ½Ã¸é °¨»çÇϰڽÀ´Ï´Ù.
#include
int max1, max2;
void update_max£¨int x£© {
if £¨max1 == x£© max2 = x;
if £¨max1 < x£© {
max2 = max1;
max1 = x;
}
if £¨max1 > x&&x > max2£© {
max2 = x;
}
}
int main£¨£© {
int a, b;
scanf£¨"%d", &max1£©;
scanf£¨"%d", &max2£©;
if £¨max2 > max1£© {
a = max1;
max1 = max2;
max2 = a;
}
scanf£¨"%d", &b£©;
if £¨b == 0£© {
update_max£¨b£©;
printf£¨"%d %d", max1, max2£©;
}
else {
update_max£¨b£©;
while £¨b != 0£© {
scanf£¨"%d", &b£©;
if £¨b == 0£©break;
update_max£¨b£©;
}
update_max£¨b£©;
printf£¨"%d %d", max1, max2£©;
}
return 0;
}