• hdu 5099 简单模拟(比较型号)


    http://acm.hdu.edu.cn/showproblem.php?pid=5099

    比较两个安卓手机型号,水题

    注意点:A is actually implicit and usually omitted for brevity.输入字符长度可能为5,这时候individual version的值为A

    #include <cstdio>
    #include <cstdlib>
    #include <cmath>
    #include <cstring>
    #include <string>
    #include <queue>
    #include <map>
    #include <iostream>
    #include <algorithm>
    using namespace std;
    #define RD(x) scanf("%d",&x)
    #define RD2(x,y) scanf("%d%d",&x,&y)
    #define RD3(x,y,z) scanf("%d%d%d",&x,&y,&z)
    #define clr0(x) memset(x,0,sizeof(x))
    #define clr1(x) memset(x,-1,sizeof(x))
    #define eps 1e-9
    const double pi = acos(-1.0);
    typedef long long LL;
    typedef unsigned long long ULL;
    const int modo = 1e9 + 7;
    const int INF = 0x3f3f3f3f;
    const int inf = 0x3fffffff;
    const LL _inf = 1e18;
    const int maxn = 105,maxm = 10005;
    int p[maxn],n,k,cas = 1;
    char a[maxn],b[maxn];
    void work()
    {
        scanf("%s%s",a,b);
        int n = strlen(a),m = strlen(b);
        printf("Case %d: ",cas++);
        if(a[0] > b[0])
            printf("%c ",'>');
        else if(a[0] == b[0])
            printf("%c ",'=');
        else
            printf("%c ",'<');
        int _a = (a[3]-'0')*10 + a[4] - '0',_b = (b[3]-'0')*10 + b[4] - '0';
        char __a,__b;
        if(n == 5)
            __a = 'A';
        else
            __a = a[5];
        if(m == 5)
            __b = 'A';
        else
            __b = b[5];
    
        if(a[1] != b[1]){
            if(a[2] < b[2] || (a[2] == b[2] && _a < _b))
               printf("%c
    ",'<');
            else if(a[2] > b[2] || (a[2] == b[2] && _a > _b))
               printf("%c
    ",'>');
            else
               printf("%c
    ",'=');
        }else if(a[1] == b[1]){
            if(a[2] < b[2] || (a[2] == b[2] && _a < _b) || (a[2] == b[2] && _a == _b && __a < __b))
               printf("%c
    ",'<');
            else if(a[2] > b[2] || (a[2] == b[2] && _a > _b) || (a[2] == b[2] && _a == _b && __a > __b))
               printf("%c
    ",'>');
            else
               printf("%c
    ",'=');
        }
        return;
    }
    int main()
    {
        int _;RD(_);
        while(_--){
            work();
        }
        return 0;
    }


  • 相关阅读:
    前端基础之CSS
    前端基础之HTML(三)
    前端基础之HTML(二)
    前端基础之HTML(一)
    面向对象总结
    内置函数总结
    函数部分总结
    文件操作总结
    基础数据类型总结
    python基础知识总结
  • 原文地址:https://www.cnblogs.com/zibaohun/p/4074370.html
Copyright © 2020-2023  润新知