水题一道。。
#include<stdio.h>
#include<stdlib.h>
int main()
{
int cookie, count = 0;
while (scanf("%d", &cookie), cookie != 5280)
{
if (count++)
putchar('\n');
int now, prev = 0, pd = abs(cookie), nd;
while (scanf("%d", &now), now != cookie)
{
nd = abs(now - cookie);
if (nd == pd)
printf("Moving from %d to %d: same.\n", prev, now);
else if (nd < pd)
printf("Moving from %d to %d: warmer.\n", prev, now);
else
printf("Moving from %d to %d: colder.\n", prev, now);
pd = nd;
prev = now;
}
printf("Moving from %d to %d: found it!\n", prev, now);
}
return 0;
}