zoukankan      html  css  js  c++  java
  • UCF Local Programming Contest 2016

    题目链接:

    https://www.jisuanke.com/contest/7194?view=challenges

    /*
    正在播放《フリージア》
    1:21  ━━━━━━●─────   5:35
       ⇆   ◁   ❚❚   ▷   ↻
    ```````'`...```````''`````````````'````````````````'`.`''
    ```````''..`';;'```''```'''''''''''''`````````````````'':
    .````''''':;;!!:````'````'''''''''''``````````````````'':
    ``''''''':;;;;;'```'``````''```````````____________```'':
    `````````:;;!;'```````````'```````'```|   所以说   |'``'':
    ```````'|$&$%:````````````'```````````|不要停下来啊|''''':
    ````'''!$&&&|'```````````'''::''::''''/ (指AC)  |':'':::
    ````'':|&&&$!'`````'''''''::.....`;!;'/_________|''``'::
      ....'|&&@$!'........```:!;'....`:;:```````````````````'
    ..````;$&&&$!:''``````'':|%%!::;|%$$!::::::::''::::::::::
    ``````!&&@&&|:'````````':|$$$$$$$$$|:':::::::::::::::::::
    `````:%&@@@@@@@@&&&@@@@&&&&@@@@@@@&&&|::::::::':::::::::;
    `````.```':|$@@@@@@@@@@@@@@@@@@@@@@@@###@@&&$|;:::'::::::
    ````````````';|$&@@@@@@@@@###@@@@@@########@@@@$!''''::::
    `````````..````:|%$@@@@@#########@#########@@@@&!''''::::
    `````````````````:|&########################@@@$;::::::::
    ``````````````````:!$@########################@%;:::'::::
    ``````````..``````':|&#######################@@&!''''''::
    ''''::'''`.`''''''':|@#######################@@&|:'`.`';!
    :::::::::``'''''';%@######################@@##@@&!::'';;;
    ::;::::::`.''''';%@@@@####################$%@##@@%;:'':;!
    :;;;;::::``':;%@@@#########################&%&##@@|:'';;!
    ;;!;;;;;;'`::;%@#############################@@##@$!'';!!
    ;;;;;;;;:``':::::;|$@############################@$!'`;!!
    ::;;;;;;:'`'::::::;!$@#######################&&@$$$;``:;;
    `````````..````````'|@#####################$;!$$$&@@|''':
    '''''''''''''':'''''|@#########@&@##########@@####@@&%|!!
    ''''''''':'''::'':''!&########&!|&@##########&&####&%|!||
    :::::'''::::::::::::!&########|:;|$@#########@&###&%||||!
    :::::::'''''':::::::!&#######@!:;!!$@########@$&##@%||||!
    
                        だからよ...止まるじゃねえぞ
     */
    View Code

    A. Majestic 10

    题意:

    给你三个数判断有几个大于等于10,0个输出zilch,一个输出double,两个输出double-double,三个输出triple-double

    思路:

    #include <bits/stdc++.h>
    
    using namespace std;
    typedef long long ll;
    typedef pair<double, int> PII;
    const int N = 100000 + 5;
    const double eps = 1e-9;
    
    int main() {
        int n;
        cin >> n;
        while (n--) {
            int ans = 0;
            int a, b, c;
            cin >> a >> b >> c;
            if (a >= 10)
                ans++;
            if (b >= 10)
                ans++;
            if (c >= 10)
                ans++;
            cout << a << " " << b << " " << c << endl;
            if (ans == 0)
                cout << "zilch" << endl;
            else if (ans == 1)
                cout << "double" << endl;
            else if (ans == 2)
                cout << "double-double" << endl;
            else if (ans == 3)
                cout << "triple-double" << endl;
            if (n)
                cout << endl;
        }
        return 0;
    }
    View Code

    B. Phoneme Palindromes

    题意:

    博主太懒了,什么都没有写

    思路:

    博主太懒了,什么都没有写

    #include <bits/stdc++.h>
    
    using namespace std;
    typedef long long ll;
    typedef pair<double, int> PII;
    const int N = 500 + 5;
    const double eps = 1e-9;
    
    set<char> v[N];
    
    bool check(char a, char b) {
        for (auto i:v[a])
            if (i == b)
                return true;
        return false;
    }
    
    int main() {
        int t;
        cin >> t;
        for (int i = 1; i <= t; i++) {
            cout << "Test case #" << i << ":" << endl;
            int p;
            cin >> p;
            for (int j = 1; j <= p; j++) {
                getchar();
                char a, b;
                cin >> a >> b;
                v[a].insert(b);
                v[b].insert(a);
            }
            int n;
            cin >> n;
            string s;
            while (n--) {
                cin >> s;
                int l = 0, r = s.length() - 1;
                bool flag = true;
                while (l <= r) {
                    if (!(s[l] == s[r] || check(s[l], s[r]))) {
                        flag = false;
                        break;
                    }
                    l++;
                    r--;
                }
                cout << s << " ";
                if (flag)
                    cout << "YES" << endl;
                else
                    cout << "NO" << endl;
            }
            for (auto &j : v)
                j.clear();
            if (i != t)
                cout << endl;
        }
        return 0;
    }
    View Code

    D. Wildest Dreams

    题意:

     女儿在奇数时间段里在车上,偶数时间段不在车上
     一旦在车上就就要调到女儿喜欢的歌曲上
     女儿在车不管到了哪首歌,都要立即跳到女儿喜欢的歌,不在车就按列表循环播放,求爸爸听了女儿喜欢的歌多少秒

    思路:

    忘了,我想想

    #include <bits/stdc++.h>
    
    using namespace std;
    typedef long long ll;
    typedef pair<double, int> PII;
    const int N = 500 + 5;
    const double eps = 1e-9;
    
    int a[N];
    
    int main() {
        int t;
        cin >> t;
        for (int o = 1; o <= t; o++) {
            cout << "CD #" << o << ":" << endl;
            int n, p;
            cin >> n >> p;
            p--;
            for (int i = 0; i < n; i++)
                cin >> a[i];
            int x;
            cin >> x;
            while (x--) {
                ll ans = 0;
                int m;
                cin >> m;
                int now = 0, timer = 0;
                for (int i = 1; i <= m; i++) {
                    int pp;
                    cin >> pp;
                    if (i % 2) {
                        now = p;
                        timer = pp % a[p];
                        ans += pp;
                    } else {
                        if (timer == 0)
                            now = (now + 1) % n;
                        while (pp) {
                            if (now == p) {
                                if (a[now] - timer >= pp) {
                                    timer += pp;
                                    ans += pp;
                                    pp = 0;
                                } else {
                                    ans += a[now] - timer;
                                    pp -= a[now] - timer;
                                    timer = 0;
                                    now = (now + 1) % n;
                                }
                            } else {
                                if (a[now] - timer >= pp) {
                                    timer += pp;
                                    pp = 0;
                                } else {
                                    pp -= a[now] - timer;
                                    timer = 0;
                                    now = (now + 1) % n;
                                }
                            }
                        }
                    }
                }
                cout << ans << endl;
    
            }
    
            if (o != t)
                cout << endl;
        }
        return 0;
    }
    View Code

    E. Loopy Word Search

    题意:

    给你一个字母表,求给出的单词出现在字母表里的位置和方向

    思路:

    按题意来就行了,简单的暴力

    #include <bits/stdc++.h>
    
    using namespace std;
    typedef long long ll;
    typedef pair<double, int> PII;
    const int N = 500 + 5;
    const double eps = 1e-9;
    
    int r, c;
    string s[N];
    int xi[4] = {0, 1, 0, -1};
    int yi[4] = {1, 0, -1, 0};
    
    bool dfs(int len, int fang, int x, int y, string now) {
        int nowx = x;
        int nowy = y;
        for (int k = 1; k <= len; k++) {
            nowx = (nowx + xi[fang] + r) % r;
            nowy = (nowy + yi[fang] + c) % c;
            if (s[nowx][nowy] != now[k])
                return false;
        }
        return true;
    }
    
    int main() {
        int t;
        cin >> t;
        for (int k = 1; k <= t; k++) {
            cout << "Word search puzzle #" << k << ":" << endl;
            cin >> r >> c;
            for (int i = 0; i < r; i++)
                cin >> s[i];
            int n;
            cin >> n;
            while (n--) {
                string m;
                cin >> m;
                int len = m.length() - 1;
                bool flag = false;
                int x = 0, y = 0, front = 0;
                for (int i = 0; i < r; i++) {
                    for (int j = 0; j < c; j++) {
                        if (s[i][j] == m[0])
                            for (int fang = 0; fang < 4; fang++) {
                                if (dfs(len, fang, i, j, m)) {
                                    front = fang;
                                    x = i;
                                    y = j;
                                    flag = true;
                                    break;
                                }
                            }
                        if (flag)
                            break;
                    }
                    if (flag)
                        break;
                }
                if (front == 0)
                    cout << "R" << " ";
                else if (front == 1)
                    cout << "D" << " ";
                else if (front == 2)
                    cout << "L" << " ";
                else if (front == 3)
                    cout << "U" << " ";
                cout << x + 1 << " " << y + 1 << " " << m << endl;
            }
            if (k != t)
                cout << endl;
        }
        return 0;
    }
    View Code

     

  • 相关阅读:
    统计学习方法 | 第1章 统计学习方法概论
    统计学习方法 | 第2章 感知机
    LeetCode | DP专题详解
    论文阅读 | Towards a Robust Deep Neural Network in Text Domain A Survey
    DFS(深度优先搜索)和BFS(广度优先搜索)
    Analysis Methods in Neural Language Processing: A Survey
    Spring AMQP 发送消息到 RabbitMQ 收到 x-queue-type 错误
    Gradle 的项目导入到 IntelliJ 后子项目源代码不能导入
    在 CentOS 7 上安装 RabbitMQ
    IntelliJ IDEA 运行项目的时候提示 Command line is too long 错误
  • 原文地址:https://www.cnblogs.com/Whiteying/p/12594838.html
Copyright © 2011-2022 走看看