zoukankan      html  css  js  c++  java
  • Codeforces Round #292 (Div. 2)

    A. Drazil and Date

    无算法,判断(s - (a + b)) % 2是否为零,若零,表示在s步内还能走向其他的地方并且回来
    否则,都是No

    #include <cstdio>
    #include <iostream>
    #include <cstring>
    #include <cmath>
    #include <algorithm>
    #include <string>
    #include <map>
    #include <vector>
    #include <set>
    using namespace std;
    
    const int MAXN = 1e6 + 10;
    const int INF = 0x3f3f3f3f;
    
    int main(void)
    {
        //freopen ("A.in", "r", stdin);
        
        long long a, b, s;
        
        while (~scanf ("%I64d%I64d%I64d", &a, &b, &s))
        {
            if (a < 0)  a = -a;
            if (b < 0)  b = -b;
            if (a + b <= s)
            {
                int x = s - (a + b);
                if (x % 2 == 0) puts ("Yes");
                else    puts ("No");
            }
            else    puts ("No");
        }
        
        return 0;
    }
    

    B. Drazil and His Happy Friends

    无算法,标记和更新happy的人就行了
    少写一个&!,导致runtime error

    #include <cstdio>
    #include <iostream>
    #include <cstring>
    #include <cmath>
    #include <algorithm>
    #include <string>
    #include <map>
    #include <vector>
    #include <set>
    using namespace std;
    
    const int MAXN = 1e6 + 10;
    const int INF = 0x3f3f3f3f;
    int a[110], b[110];
    
    int main(void)
    {
        //freopen ("B.in", "r", stdin);
        
        int n, m;
        scanf ("%d%d", &n, &m);
        
        memset (a, 0, sizeof (a));
        memset (b, 0, sizeof (b));
        
        int x, y, tmp, cnt = 0;
        scanf ("%d", &x);
        for (int i=0; i<x; ++i)
        {
            scanf ("%d", &tmp);
            a[tmp] = 1;
            cnt++;
        }
        scanf ("%d", &y);
        for (int i=0; i<y; ++i)
        {
            scanf ("%d", &tmp);
            b[tmp] = 1;
            cnt++;
        }
        
        for (int i=0; i<=m*n*2; ++i)
        {
            if (a[i%n] || b[i%m])
            {
                if (!a[i%n])    cnt++;
                if (!b[i%m])    cnt++;
                a[i%n] = b[i%m] = 1;
            }
        }
        (cnt == n + m) ? puts ("Yes") : puts ("No");
        
        return 0;
    }
    

    C. Drazil and Factorial

    无算法,数学问题貌似就是对单个数字分解质因数,替换,然后sort排序就行了

    #include <cstdio>
    #include <iostream>
    #include <cstring>
    #include <cmath>
    #include <algorithm>
    #include <string>
    #include <map>
    #include <vector>
    #include <set>
    using namespace std;
    
    const int MAXN = 1e6 + 10;
    const int INF = 0x3f3f3f3f;
    
    string res[10] = {"", "", "2", "3", "322", "5", "53", "7", "7222", "7332"};
    
    int main(void)
    {
        //freopen ("C.in", "r", stdin);
        
        int n;
        while (cin >> n)
        {
            string s, ans;
            cin >> s;
            for (int i=0; i<s.size(); ++i)
            {
                ans += res[s[i] - '0'];
            }
            sort (ans.begin (), ans.end ());
            reverse (ans.begin (), ans.end ());
            
            cout << ans << endl;
        }
        
        return 0;
    }
    编译人生,运行世界!
  • 相关阅读:
    MySql 用户 及权限操作
    MAC 重置MySQL root 密码
    在mac系统安装Apache Tomcat的详细步骤[转]
    Maven:mirror和repository 区别
    ES6 入门系列
    转场动画CALayer (Transition)
    OC 异常处理
    Foundation 框架
    Enum枚举
    Invalid App Store Icon. The App Store Icon in the asset catalog in 'xxx.app' can’t be transparent nor contain an alpha channel.
  • 原文地址:https://www.cnblogs.com/Running-Time/p/4366760.html
Copyright © 2011-2022 走看看