1 solutions

  • 0
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        int a[10000];
        int n=2;
        cin>>a[1];
        if(a[1]==0)
        {
            return 0;
        }
        while(a[n]==0)
        {
            cin>>a[n];
            if(a[n]==0)
            {
    			break;
    		}
    	//	cout<<a[n]<<" "<<n<<endl;
    		n++;
        }
        n--;
        //cout<<n<<endl;
        for(int i=n;i>=1;i--)
        {
            cout<<a[i]<<" ";
        }
    return 0;
    }
    
    • 1

    Information

    ID
    396
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    5
    Tags
    (None)
    # Submissions
    99
    Accepted
    40
    Uploaded By