• 2019年3月10日 天梯赛校选(解答)


    题目:https://www.cnblogs.com/lightac/p/10534726.html

    第一题

     1 #include <iostream>
     2 #include <cstring>
     3 
     4 using namespace std;
     5 
     6 int main() {
     7     int num = 0;
     8     char a[1001], b[1001];
     9     cin >> num;
    10     for (int i = 0; i < num; ++i) {
    11         cin >> a;
    12         cin >> b;
    13         if (strcmp(a, b) > 0)
    14             cout << ">" << endl;
    15         else if (strcmp(a, b) < 0)
    16             cout << "<" << endl;
    17         else
    18             cout << "=" << endl;
    19     }
    20     return 0;
    21 }

    第二题

    #include <iostream>            //不确定
    
    using namespace std;
    
    int main()
    {
        int num = 0;
        cin >> num;
        while (num--) {
            int m = 0, n = 0;
            cin >> n >> m;
            if (m >= n)
                cout << "Yes" << endl;
            else if (!(n % (m + 1)))
                cout << "No" << endl;
            else
                cout << "Yes" << endl;
        }
    }

    第三题

     1 #include <iostream>                        //找的板子
     2 #include <string>
     3 #include <vector>
     4 #include <algorithm>
     5 #include <stdexcept>
     6 #define MAXN 1000
     7 
     8 using namespace std;
     9 
    10 int a[MAXN], b[MAXN];
    11 int main(int argc, const char * argv[])
    12 {
    13     int num = 0;
    14     cin >> num;
    15     while (num--) {
    16         string str1, str2;
    17         long int len1, len2;
    18         long int i, j, k;
    19         int up;
    20 
    21         cin >> str1 >> str2;
    22         len1 = str1.length();
    23         len2 = str2.length();
    24         memset(a, 0, sizeof(a));
    25         memset(b, 0, sizeof(b));
    26         for (i = len1 - 1, k = 0; i != -1; --i)
    27         {
    28             a[k] = str1[i] - '0';
    29             k++;
    30         }
    31         for (j = len2 - 1, k = 0; j != -1; --j)
    32         {
    33             b[k] = str2[j] - '0';
    34             k++;
    35         }
    36         for (i = 0, up = 0; i < MAXN; ++i)
    37         {
    38             a[i] = a[i] + b[i] + up;
    39             up = a[i] / 10;
    40             a[i] %= 10;
    41         }
    42         for (i = MAXN - 1; i != -1; --i)
    43         {
    44             if (a[i])
    45             {
    46                 break;
    47             }
    48         }
    49         for (k = i; k != -1; --k)
    50         {
    51             cout << a[k];
    52         }
    53         cout << endl;
    54     }
    55     return 0;
    56 }
    作者:LightAc
    出处:https://www.cnblogs.com/lightac/
    联系:
    Email: dzz@stu.ouc.edu.cn
    QQ: 1171613053
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利。
  • 相关阅读:
    centos set up samba
    iptables基础及samba配置举例
    CentOS 7.x samba 服务器安装
    (总结)RHEL/CentOS 7.x的几点新改变
    Linux Samba文件共享服务配置
    光纤交换机端口故障排查
    FAQ-SNS交换机的端口状态及排查流程说明
    Oracle 降低高水位线的方法
    Java异常处理机制
    noVNC连接多台远程主机
  • 原文地址:https://www.cnblogs.com/lightac/p/10534727.html
Copyright © 2020-2023  润新知