8 条题解

  • 0

    #include<iostream>
    using namespace std;
    #include<algorithm>
    #include<cmath>
    #include<string>
    #include <math.h>
    int arr[100000] = { 1,1 };
    int main() {
    int a;
    int sum = 0;
    cin >> a;
    string a1 = to_string(a);
    int n = a1.length();
    for (int i = 0; i < n; i++) {
    arr[i] = (a % 10);
    a /= 10;
    }
    for (int i = n; i >= 0; i--) {
    sum += pow(10, n-i-1) * arr[i];
    }
    cout << sum;
    }

  • -1
    @ 2021-03-19 20:50:02
    #include<iostream>
    using namespace std;
    int main(){
        string a;
        getline(cin,a);
        string::iterator it=a.end()-1;
        for(;it>=a.begin();it--) cout<<*it;
        return 0;
    }
    
  • -1

    #include <iostream>
    using namespace std;
    int main()
    {
    int x;
    int y=0;
    cin>>x;

    while( x>0 )
    {
    int x1=x%10;

    y=y*10+x1;

    x=x/10;

    }

    cout<<y<<endl;
    return 0;
    }

  • -2

    #include<iostream>

    using namespace std;

    int main()
    {

    int a;
    cin>>a;
    while(a)
    {
    cout<<a-a/10*10;
    a/=10;
    }
    return 0;
    }

  • -2
    @ 2021-01-26 12:29:25

    #include <iostream>
    using namespace std;

    int main()
    {
    int x;
    cin>>x;
    int y=0;

    while( x>0 )
    {
    int x1=x%10;
    cout<<x1;

    y=y*10+x1;

    x=x/10;

    }

    return 0;
    }

  • -2

    #include <iostream>
    using namespace std;

    int main()
    {
    int x;
    cin>>x;
    int y=0;

    for(int xx=x; xx>0; xx=xx/10)
    {
    int x1=xx%10;

    y=y*10+x1;

    }

    cout<<y<<endl;
    return 0;
    }

  • -2
    #include<iostream>
    using namespace std;
    
    struct Node
    {
        int data;
        Node *next;
    };
    
    class LinkList
    {
    private:
        Node *head;
    public:
        LinkList()
        {
            head=NULL;
        }
    
        void set_list(int x)
        {
            Node *tail;
            //int len=get_len(x);
            while(x>0)
            {
                Node *newp=new Node;
                newp->data=x%10;
                if(head==NULL)
                {
                    head=newp;
                    tail=newp;
                }
                else
                {
                    tail->next=newp;
                    tail=newp;
                }
                if(tail!=NULL)
                    tail->next=NULL;
                x=x/10;
            }
        }
    
        void output()
        {
            Node *p;
            p=head;
            while(p!=NULL)
            {
                cout<<p->data;
                p=p->next;
            }
            cout<<endl;
        }
    
    
        friend int get_len(int x);
    };
    
    int get_len(int x)
    {
        int flag=0;
        while(x>0)
        {
            x=x/10;
            flag++;
        }
        return flag;
    }
    
    
    int main()
    {
        int x;
        cin>>x;
        LinkList list;
        list.set_list(x);
        list.output();
    
        system("pause");
        return 0;
    }
    
  • -3

    #include <iostream>
    using namespace std;

    int main()
    {
    int x,y;
    cin>>x;
    while( x>0 )
    {
    int x1=x%10;

    x=x/10;
    y=y*10+x1;

    }

    cout<<y<<endl;
    return 0;
    }

  • 1

信息

难度
5
分类
(无)
标签
递交数
2487
已通过
817
通过率
33%
被复制
9
上传者