【蓝桥杯第十届省赛B】(部分详解)

特别数的和

#include <iostream>
#include <string>
using LL=long long;
using namespace std;

int main() {
    LL n;
    cin >> n;
    LL cnt = 0;
    for (LL i = 1; i <= n; i++) {
        string s = to_string(i);
        for (LL j = 0; j < s.size(); j++) {
            if (s[j] == '2' || s[j] == '0' || s[j] == '1' || s[j] == '9') {
                cnt += i;
                break; // 在找到符合条件的数字后退出内层循环
            }
        }
    }
    cout << cnt;
    return 0;
}

数列求值

#include <iostream>
using namespace std;
const int n=20190325;
int a[n]={0,1,1,1};
int main()
{
    
   for(int i=4;i<=n;i++)
    {
        a[i]=(a[i-1]+a[i-2]+a[i-3])%10000;
        //注意范围
    }
    cout<<a[20190324];
  // 请在此输入您的代码
  return 0;
}

组队

方法一:神经网络算法

#include <iostream>
using namespace std;
int main()
{
  cout<<500-3-1-1-3-2;
  return 0;
}

方法二:解题区cv大法(谢谢佬)

#include <iostream>
int main()
{
  // 请在此输入您的代码
  int aa[]={97,92,0,0,89,82,0,0,0,95,0,0,94,0,0,0,98,93,0,0};
  int bb[]={90,85,0,0,83,86,0,97,0,99,0,0,91,83,0,0,83,87,0,99};
  int cc[]={0,96,0,0,97,0,0,96,89,0,96,0,0,87,98,0,99,92,0,96};
  int dd[]={0,0,0,80,0,0,87,0,0,0,97,93,0,0,97,93,98,96,89,95};
  int ee[]={0,0,93,86,0,0,90,0,0,0,0,98,0,0,98,86,81,98,92,81};
  int a,b,c,d,e,n,max=0;
  for(a=1;a<20;a++){
    for(b=1;b<20;b++){
      for(c=1;c<20;c++){
        for(d=1;d<20;d++){
          for(e=1;e<20;e++){
            n=aa[a]+bb[b]+cc[c]+dd[d]+ee[e];
            if(max<=n&&a!=b&&a!=c&&a!=d&&a!=e&&b!=c&&b!=d&&b!=e&&c!=d&&c!=e&&d!=e){ max=n; }
          }
        }
      }
    }
  }
cout<<max;
return 0;
}

年号字符串

#include <bits/stdc++.h>
using namespace std;
int main()
{
    char a[27];
    for (int i = 1; i <= 26; i++)
     a[i] = (char)(65+i-1);
    int x = 2019 / 26 / 26;
    int y = 2019 / 26 % 26;
    int z = 2019 % 26;
    cout << a[x] << a[y] << a[z] << endl;
    return 0;
}

相关推荐

  1. B】(部分详解

    2024-04-07 20:36:05       44 阅读
  2. 十一届B】(部分详解

    2024-04-07 20:36:05       37 阅读
  3. C++B组题解

    2024-04-07 20:36:05       42 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-07 20:36:05       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-07 20:36:05       101 阅读
  3. 在Django里面运行非项目文件

    2024-04-07 20:36:05       82 阅读
  4. Python语言-面向对象

    2024-04-07 20:36:05       91 阅读

热门阅读

  1. IoT数采平台2:文档

    2024-04-07 20:36:05       39 阅读
  2. 计算两线段之间的最短距离

    2024-04-07 20:36:05       37 阅读
  3. git环境切换

    2024-04-07 20:36:05       34 阅读
  4. 【STL】概述

    2024-04-07 20:36:05       38 阅读
  5. 系统规划与管理师今年改版?你关心的都在这里

    2024-04-07 20:36:05       40 阅读
  6. 如何利用OceanBase v4.2的 Runtime Filter提升查询效率

    2024-04-07 20:36:05       29 阅读
  7. MySQL 慢查询优化案例

    2024-04-07 20:36:05       38 阅读
  8. RESTful API如何使用及构建 web 应用程序(附代码)

    2024-04-07 20:36:05       42 阅读
  9. Docker是一个开源的应用容器引擎

    2024-04-07 20:36:05       40 阅读