zoukankan      html  css  js  c++  java
  • 2020 Codeforces 愚人节比赛题解 A~D

    CF1331A Is it rated?

    看标题,Is it rated?,这是一个一般疑问句,回答肯定是 YES 或者 NO,随便猜一下。

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        cout << "NO";
        return 0;
    }
    

    CF1331B Limericks

    题目描述

    给你一个数,请你找到两个数 (a)(b),使得 (a imes b = n),同时请你保证 (a) 尽量小。

    输入格式

    一行一个正整数 (n)

    输出格式

    一行,两个正整数,中间没有空格。

    Code

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
        cin >> n;
        for(int i=2; i<=n; i++)
            if(n % i == 0)cout << i << n / i << endl, exit(0);
        return 0;
    }
    

    CF1331C ...And after happily lived ever they

    输入 (n),将其转换为 (6) 位二进制,然后将第一位与第五位交换,第三位与第四位交换(从右往左),最后,再转成十进制。

    #include <bits/stdc++.h>
    using namespace std;
    bool a[7];
    int main()
    {
        int n;
        cin >> n;
        for (int i = 0; i < 6; i++)
            a[i] = (n >> (5 - i)) & 1;
        int x;
        swap(a[1], a[5]);
        swap(a[2], a[3]);
        int ans = 0;
        for (int i = 0; i < 6; i++)
            ans = ans * 2 + a[i];
        cout << ans;
        return 0;
    }
    

    CF1331D Again?

    输入 A 和一个正整数 (n),请判断 (n) 是奇数还是偶数,奇数则输出 1,否则输出 0

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
        scanf("A%d", &n);
        if(n % 2)cout << 1;
        else     cout << 0;
        return 0;
    }
    

    关于 E~H:

    • 它死了
    • 它咕了
  • 相关阅读:
    【node.js】GET/POST请求、Web 模块
    【node.js】全局变量、常用工具、文件系统
    【node.js】函数、路由
    【node.js】模块系统、函数
    【node.js】Stream(流)
    跨域问题的产生,怎么解决它?
    array.splice()
    数组的方法
    js跨域请求的5中解决方式
    3分钟看懂flex布局
  • 原文地址:https://www.cnblogs.com/tearing/p/12643388.html
Copyright © 2011-2022 走看看