1 条题解

  • 0
    @ 2025-2-14 21:22:42

    C++ :

    #include<iostream>
    #include<vector>
    using namespace std;
    int a[1000000];
    int main()
    {
    	int x,i=1;
    	while(cin>>x)
    	{
    		a[i]=x;
    		++i;
    	}
    	cout<<a[i-1];
    	for(int j=i-2;j>=1;--j)
    	cout<<" "<<a[j];
    	
    	return 0;
    }
    

    Java :

    import java.util.*;
    import java.util.regex.Pattern;
    public class Main {
    	public static void main(String[] args) {
    		Scanner input = new Scanner(System.in);
    		Stack<Integer> s = new Stack<>();
    		for(int index = 0;index < 6;index++) {
    			s.push(index + 1);
    		}
    		for(int index = 0;index < 6;index++) {
    			System.out.print(s.pop() + " ");
    		}
    	}
    }
    
    • 1

    信息

    ID
    860
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    (无)
    递交数
    0
    已通过
    0
    上传者