zltzlt 发表于 2020-1-14 11:32:28

洛谷题目 P1427

// https://www.luogu.com.cn/problem/P1427

#include <iostream>
using namespace std;

int main()
{
    int a = {}, i = 0, n = 0, j;
    while (true)
    {
      cin >> j;
      if (j == 0)
            break;
      a = j;
      n++;
      i++;
    }
    for (i = (n - 1); i >= 0; i--)
    {
      if (i == 0)
            cout << a;
      else
            cout << a << " ";
    }
    return 0;
}
页: [1]
查看完整版本: 洛谷题目 P1427