Luo Gu P1427. Fish numbers game

Luo Gu P1427. Fish numbers game

Title Description

Fish was recently asked to participate in a numbers game, asking it to see a string of numbers (not necessarily the length, ending in 0, up to more than 100, numbers do not exceed 2 ^ 32-1), then remembered the opposite of read out (indicating the end of the numbers 0, do not read out). This small fish is memory that point it is too difficult, you do not think about just how much the overall head of fish, some of which still delicious meat! So please help fish programming to solve this problem.

Input Format

A string of one line input integer, 0 to end, with a space interval.

Output Format

The output line of the string of integers backwards, with a space interval.

Sample input and output

Input Sample # 1
3 65 23 5 34 1 30 0
Sample Output # 1
30 1 34 5 23 65 3

Topic ideas

#include<iostream>
using namespace std;
const int N = 110;
int a[N];
int main()
{
    int i=0;
    do{
        scanf("%d",&a[i]);
    }while(a[i++]);
    for(i-=2;i>=0;i--)
        printf("%d ",a[i]);
    return 0;
}

Guess you like

Origin www.cnblogs.com/fsh001/p/12285232.html