模拟
一只蓝色小鲨鱼
并不是我们主动选择辛苦和努力,而是别无选择!!!
一枚25考研,考公人。加油加油!!!
展开
-
牛客某白月赛50 生日
登录—专业IT笔试面试备考平台_牛客网思路:#include<bits/stdc++.h>using namespace std;const int N=200010,mod=1e9+7; typedef long long ll;ll a[N];ll ksm(ll a,ll b)//模板;{ ll res=1; while(b) { if(b&1)res=res*a%mod; b>&...原创 2022-05-22 10:44:34 · 128 阅读 · 0 评论 -
(二分) [COCI 2011/2012 #5] EKO / 砍树
展开题目描述伐木工人 Mirko 需要砍MM米长的木材。对 Mirko 来说这是很简单的工作,因为他有一个漂亮的新伐木机,可以如野火一般砍伐森林。不过,Mirko 只被允许砍伐一排树。Mirko 的伐木机工作流程如下:Mirko 设置一个高度参数HH(米),伐木机升起一个巨大的锯片到高度HH,并锯掉所有树比HH高的部分(当然,树木不高于HH米的部分保持不变)。Mirko 就得到树木被锯下的部分。例如,如果一排树的高度分别为20,15,1020,15,10和1717,Mi...原创 2022-05-16 16:36:13 · 183 阅读 · 0 评论 -
【无标题】E. Eating Queries
1000测试数据;给定 n快糖果,每个糖果的价值是, 有 q次询问,每次询问给定义一个,问至少吃多少块糖果可以是总价值大于等于。贪心的想,每次从最大的开始吃.观察到 n,q<=1.5*1e5;排序后,考虑用前缀和维护数组,对于每次询问,二分找即可。复杂度核心代码超时了,为O(N) 于是考虑改为O(logN),前缀和加二分查询;sort(g,g+n); reverse(g,g+n); while(m--) { int x; cin...原创 2022-05-12 17:01:23 · 312 阅读 · 0 评论 -
Codeforces Round #790 (Div. 4)D. X-Sum
Timur's grandfather gifted him a chessboard to practice his chess skills. This chessboard is a gridaawithnnrows andmmcolumns with each cell having anon-negativeinteger written on it.Timur's challenge is to place a bishop on the board such that t...原创 2022-05-11 10:11:50 · 493 阅读 · 0 评论 -
Codeforces Round #790 (Div. 4)C. Most Similar Words
You are givennnwords ofequallengthmm, consisting of lowercase Latin alphabet letters. Theii-th word is denotedsisi.In one move you can chooseany position in any single wordand change the letter at that position to the previous or next l...原创 2022-05-11 09:26:48 · 563 阅读 · 0 评论 -
Codeforces Round #790 (Div. 4)B. Equal Candies
#include <iostream>#include <algorithm>#include <cstring> using namespace std; const int N=1010; int n,m;int f[N];int t;int g[N]; int main(){ int t; cin>>t; while(t--) { cin>>n; for(int i=1;i<=n;...原创 2022-05-11 09:23:37 · 156 阅读 · 0 评论 -
【无标题】P4924 [1007]魔法少女小Scarlet
找规律 1 2 3 7 4 1 4 5 6 -----> 8 5 2 7 8 9 9 6 3复制矩阵,再赋值给对应位置原矩阵;#include<...原创 2022-05-10 15:33:19 · 132 阅读 · 0 评论 -
【无标题】P1563 [NOIP2016 提高组] 玩具谜题(模拟)
https://www.luogu.com.cn/problem/P1563#include <iostream> //常用开头模板,保存在文档,下次直接用 #include <algorithm>#include <cstring>#define sx first#define sy secondusing namespace std;typedef long long LL;typedef pair<int,s...原创 2022-05-08 12:12:27 · 233 阅读 · 0 评论 -
洛谷 P1002 [NOIP2002 普及组] 过河卒(线性dp)
//状态表示 f[i][j]表示 走到(i,j)的集合;// 属性:方案数;// 计算 f[i-1][j]+f[i][j-1];//坑点: 爆int ,而且范围还不会计算,一遍遍试,积累经验;// 有 f[i-1][j],f[i][[j-1]; 题目从(0,0)开始// 会数组越界; //马本身也不能走; //巧妙:有马可到的地方 f[i][j]置为0;退出,不更新; #include <iostream>#inclu...原创 2022-05-06 13:05:55 · 218 阅读 · 0 评论 -
P2670 [NOIP2015 普及组] 扫雷游戏(模拟)
#include <iostream>#include <algorithm>#include <cstring>using namespace std;typedef long long LL;typedef pair<int,int>PII;const int N=110;int n,m;char g[N][N];int dx[]={1,-1,0,0,-1,-1,1,1};int dy[]={0,0,1,-1,...原创 2022-05-08 10:48:19 · 970 阅读 · 0 评论