#include <iostream> using namespace std; int a, b, len; long long ans; string s; void dfs(int idx, long long now) { if (idx >= len) { ans = max(now, ans); return; } int na = '9' - s[idx]; int nb = s[idx] - '0' + 1; int k = min(a, na); a -= k; df...
#include<bits/stdc++.h>usingnamespacestd;intn, m;inta[100005], b[100005];boolcheck(intd){intt = m +1;// 把2L看作多一个跳板for(inti =1; i <= n; i++){t -= (b[i] -1) / d;if(t <0)returnfalse;}returntrue;}intmain(){cin >> n >> m;for(inti =1; i <= n; i...
斩获60w大厂offer,985计算机考研上岸,256题算法特训课:https://dashoj.com/courses/2/66ab402a32c85b02ffd6f8c7#1722499114952题目提交地址:https://dashoj.com/p/193, 视频播放量 600、弹幕量 0、点赞数 16、投硬币枚数 3、收藏人数 11、转发人数 2, 视频作者 Dashcodi
第一行包含一个整数N。 以下N行每行两个整数a和b,表示a和b之间有一条数据链接相连。 对于30%的数据,1 <= N <= 1000 对于100%的数据, 1 <= N <= 100000, 1 <= a, b <= N 输入保证合法。 输出 --- 按从小到大的顺序输出在环路上的电脑的编号,中间由一个空格分隔。 样例输入: 5 1 2 3 ...
// B: 选数概率 #include <bits/stdc++.h> #pragma GCC optimize(2) #define int long long #define endl '\n' using namespace std; const int MAX = 2e5+5; void solve() { const int f1 = 2585, f2 = 2632, f3 = 1540, m = 10455; // p12=f1/m, p23=f2/m, p13=f3/m int s...
为了帮助需要的人,我整理了2024年蓝桥杯C/C++ B组国赛的题解,包含标准答案和暴力解法,可能有些是赛后回顾,可能存在比赛时正确但代码瑕疵的问题。如发现解释有误,欢迎指正。A题:合法密码 通过枚举法检查,个人认为正确答案是400,部分答案为618,可能是因为对题意理解不同。B题:选数概率 这是...
为偶数) 同学,老师想把所有的同学进行分组,每两名同学一组。为了公平,老师给每名同学随机分配了一个 以内的正整数作为 ,第 名同学的 为 。 老师希望通过更改若干名同学的 使得对于任意一名同学 ,有且仅有另一名同学 的 与其相同 ( )。请问老师最少需要更改多少名同学的 ...
代码: #include<iostream> using namespace std; int a[20][5]; int sum = 0; int main() { for(int i=0;i<20;i++) for (int j = 0; j < 5; j++) { cin >> a[i][j]; } for(int i1=0;i1<20;i1++) for(int i2=0;i2<20;i2++) ...
斩获60w大厂offer,985计算机考研上岸,256题算法特训课:https://dashoj.com/courses/2/66ab402a32c85b02ffd6f8c7#1722499114952题目提交地址:https://dashoj.com/p/195, 视频播放量 483、弹幕量 0、点赞数 8、投硬币枚数 2、收藏人数 10、转发人数 1, 视频作者 Dashcodin
/*1Byte=8bit 1KByte=1024Byte 1M=1024KByte 1MB/s=8Mbps 200Mbps=25MB/s*/ <>B题 纯质数 /**1903*/ #include <bits/stdc++.h> using namespace std; const int maxn = 20210610; int f[maxn];// 0是质数 1是非质数 void init(){ f[1]=1,f[0]=1; for(int i=2;i< ...