3 条题解

  • 6
    @ 2019-04-09 21:54:15
    #include<stdio.h>
    #include<stdlib.h>
    int main()
    {
        int n, a;
        int first;
        scanf("%d", &n);
        scanf("%d", &first);
        for (int i = 1; i < n; i++)
        {
            scanf("%d", &a);
            printf("%d ", a);
        }
        printf("%d", first);
    }
    /*
    // 动态数组的方法
    int main()
    {
        int n;
        int *arr;
        scanf("%d", &n);
        arr = (int *)malloc(sizeof(int)*n);
        for (int i = 0; i < n; i++)
        {
            scanf("%d", arr + i);
        }
        for (int i = 1; i < n; i++)
        {
            printf("%d ", *(arr + i));
        }
        printf("%d", *arr);
        free(arr);
    }
    */
    /*
    // 链表的方法
    typedef struct node
    {
        int data;
        struct node *next;
    }Node, *pNode;
    int main()
    {
        pNode head, p, s, q;
        int n;
        int x;
    
        head = (pNode)malloc(sizeof(Node));
        p = head;
        head->next = NULL;
        scanf("%d", &n);
        for (int i = 0; i < n; i++)
        {
            scanf("%d", &x);
            s = (pNode)malloc(sizeof(Node));
            s->data = x;
            s->next = NULL;
            p->next = s;
            p = s;
        }
    
        p = head->next;
        x = p->data;
        p = p->next;
    
        for (int i = 0; i < n-1; i++)
        {
            printf("%d ", p->data);
            p = p->next;
        }
        printf("%d", x);
    }
    */
    
  • 1

    #include <iostream>
    using namespace std;
    int main()
    {
    int x,y,z;
    cin>>x;
    cin>>y;
    for(int a=1; a<x; a++)
    {
    cin>>z;
    cout<<z<<" ";
    }
    cout<<y<<" ";
    return 0;
    }

  • 0
    @ 2022-10-09 14:27:56

    #include <stdio.h>
    //有warning
    int main(){
    long long int n;
    scanf("%lld",&n);
    int a[n];
    for(long long int i=0;i<n;i++){
    scanf("%lld",&a[i]);
    }
    for(long long int i=1;i<n;i++){
    printf("%lld ",a[i]);
    }
    printf("%lld",a[0]);
    return 0;
    }

  • 1

信息

难度
9
分类
(无)
标签
递交数
3166
已通过
231
通过率
7%
被复制
17
上传者