zoukankan      html  css  js  c++  java
  • CB--19蓝桥杯

    01

    02

    #include <iostream>
    #include <cstdio>
    #include <cmath>
    #include <cstdlib>
    #include <algorithm>
    #include <cstring>
    #include <vector>
    #include <queue>
    #include <stack>
    #include <map>
    #include <set>
    
    using namespace std;
    
    struct lqb {
        
    };
    
    int main()
    {
        int year = 2019;
        stack<int> ans;
        while(year) {
            if(year / 26 > 0)
                ans.push(year % 26);
            else
                break;
            year /= 26;
        }
        cout<<(char)(year + 64);
        while(!ans.empty()) {
            cout<<(char)(ans.top() + 64);
            ans.pop();
        }
        return 0;
    }
    View Code

    03

    #include <iostream>
    #include <cstdio>
    #include <cmath>
    #include <cstdlib>
    #include <algorithm>
    #include <cstring>
    #include <vector>
    #include <queue>
    #include <stack>
    #include <map>
    #include <set>
    
    using namespace std;
    
    struct lqb {
        
    };
    
    int main()
    {
        int f1 = 1,f2 = 1, f3 = 1,f4 = 0,i = 3;
        while(i++) {
            f4 = (f1 + f2 + f3) % 10000;
            if( i == 20190324) {
                cout<<f4;
                break;
            }
            f1 = f2;
            f2 = f3;
            f3 = f4;
        }
        return 0;
    }
    View Code

    04

    //#include<bits/stdc++.h> 
    #include <iostream>
    #include <cstdlib>
    #include <cstdio>
    #include <fstream> 
    #include <iomanip>        // 格式化输入输出 
    #include <cmath>
    #include <vector>
    #include <cstring>
    #include <stack>
    #include <queue>
    #include <map>
    #include <set>
    #include <algorithm>
    
    using namespace std;
    
    bool Function(int n) {
        int i;
        do {
            i = n % 10;
            if(i == 2 || i == 4)
                return false;
            n = n / 10;
        }while(n);
        return true;
    }
    
    int main()
    {
        int ans = 0;
        for(int i = 1;i < 2019;i++) {
            if( !Function(i) )
                continue;
            for(int j = i + 1;j < 2019;j++) {
                if( !Function(j) )
                    continue;
                for(int k = j + 1;k < 2019;k++) {
                    if( !Function(k) )
                        continue;    
                    if(i + j + k == 2019)
                        ans++;
                }
            }
        }
        cout<<ans<<endl;
        return 0;
    }
    View Code

    05

    #include <iostream>
    #include <cstdio>
    #include <cmath>
    #include <cstdlib>
    #include <algorithm>
    #include <cstring>
    #include <vector>
    #include <queue>
    #include <stack>
    //#include <map>
    #include <set>
    
    using namespace std;
    
    #define L 30
    #define W 50
    
    char map[L][W];
    int dir[4][2] = {{1,0},{0,-1},{0,1},{-1,0}};     // D  L  R  U
    char ch[4] = {'D','L','R','U'};
    int vis[L][W] = {0};
    
    struct Point {
        int x;
        int y;
        string road;
        Point(int a,int b):x(a),y(b) {    }
    }; 
    
    void BFS() {
        queue<Point> q;
        Point p(0,0);
        p.road = "";
        q.push(p);
        vis[0][0] = 1;
        while(!q.empty()) { // 空 = true 
            Point t = q.front();
            q.pop();
            if(t.x == L - 1 && t.y == W - 1) {
                cout<<t.road<<endl;
                break;
            }
            for(int i = 0;i < 4;i++) {
                int dx = t.x + dir[i][0];
                int dy = t.y + dir[i][1];
                if(dx >= 0 && dx < L && dy >= 0 && dy < W) {
                    if(map[dx][dy] == '0' && !vis[dx][dy]) {
                        Point tt(dx,dy);
                        tt.road = t.road + ch[i];
                        q.push(tt);
                        vis[dx][dy] = 1;
                    }
                }
            } 
        }    
    }
    
    int main()
    {
        for(int i = 0;i < L;i++) {
            for(int j = 0;j < W;j++)
                scanf("%c",&map[i][j]);
            getchar();    
        }
        cout<<endl<<endl;
        BFS();
        return 0;
    }
    View Code

    06

    //#include<bits/stdc++.h> 
    #include <iostream>
    #include <cstdlib>
    #include <cstdio>
    #include <fstream> 
    #include <iomanip>        // 格式化输入输出 
    #include <cmath>
    #include <vector>
    #include <cstring>
    #include <stack>
    #include <queue>
    #include <map>
    #include <set>
    #include <algorithm>
    
    using namespace std;
    
    bool Function(int n) {
        int i;
        while(n) {
            i = n % 10;
            if(i == 2 || i == 0 || i == 1 || i == 9)
                return true;
            n = n / 10;
        }
        return false;
    }
    
    int main()
    {
        int ans = 0,n;
        cin>>n;
        for(int i = 1;i <= n;i++) {
            if(Function(i))
                ans += i;
        }
        cout<<ans<<endl;
        return 0;
    }
    View Code

    07

    08

    09

    10

  • 相关阅读:
    封装小程序http请求
    ES6为数组做的扩展
    练习题
    二叉树的遍历
    快速搭建vue项目
    收集的前端面试大全
    ios兼容webp格式的图片
    小程序开发API之获取启动参数
    使用HTML编写邮件
    深入理解javascript原型和闭包(9)——this
  • 原文地址:https://www.cnblogs.com/2015-16/p/13737192.html
Copyright © 2011-2022 走看看