zoukankan      html  css  js  c++  java
  • luogu P1427 小鱼的数字游戏

    传送门

    今天是2019.5.27 距离NOIP2019还有165天

    今天起手先刷一道大水题练手感

    题目很简单 正序输入倒序输出 没个数

    然而我一开始把它想成了一道字符串的题

    后来发现多位数会颠倒数位

    上代码

    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<cctype>
    #include<cstdlib>
    #include<string>
    #include<iostream>
    #include<algorithm>
    #include<set>
    #include<map>
    #include<queue>
    #include<stack>
    #include<vector>
    #define enter puts("")
    #define space putchar(' ')
    using namespace std;
    typedef long long ll;
    ll read()
    {
        ll op = 1, ans = 0;
        char ch = getchar();
        while(ch < '0' || ch > '9')
        {
            if(ch == '-') op = 0;
            ch = getchar();
        }
        while(ch >= '0' && ch <= '9')
        {
            ans *= 10;
            ans += ch - '0';
            ch = getchar();
        }
        return op ? ans : -ans;
    }
    void write(ll x)
    {
        if(x < 0)
        {
            x = -x;
            putchar('-');
        }
        if(x >= 10) write(x / 10);
        putchar(x % 10 + '0');
    }
    ll drug[10005];
    int main()
    {
        int num = 0;
        while(1)
        {
            drug[++num] = read();
            if(drug[num] == 0) break;        
        }
        for(int i = num - 1;i > 0;i--) write(drug[i]), space;
        enter;
        return 0;
    }
  • 相关阅读:
    IfcFeatureElementAddition
    IfcOpeningElement
    IfcRelNests
    IfcElementAssemblyType
    IfcProjectionElement
    IfcFeatureElement
    IfcRelDefines
    Win10 Anaconda配置tensorflow
    Anaconda升级
    Anaconda 台式机环境
  • 原文地址:https://www.cnblogs.com/thx666/p/10932987.html
Copyright © 2011-2022 走看看