当前位置:网站首页>Niu Ke Xiaobaiyue Race 53 A-E
Niu Ke Xiaobaiyue Race 53 A-E
2022-07-30 21:06:00 【Salted egg_dd】
目录
A-Raining
原题链接<<See the original title here
思路:简单 略
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d,x,ans;
ans=0;
scanf("%d%d%d%d",&a,&b,&c,&d);
scanf("%d",&x);
if(a<x)
printf("%d ",x-a);
else
printf("0 ");
if(b<x)
printf("%d ",x-b);
else
printf("0 ");
if(c<x)
printf("%d ",x-c);
else
printf("0 ");
if(d<x)
printf("%d ",x-d);
else
printf("0 ");
return 0;
}B-Kissing
原题链接-See the original title here
思路:Expand the formula and simplify it
,根据1-nThe summation formula can be found beforen项为(n)*(n+1)-n,Because the answer will be very large, it is necessary to model it,But the process volume will be huge,So the final result model is not acceptable,Every item must be modeled
#include <bits/stdc++.h>
using namespace std;
const int N=998244353;
int main()
{
long long int n;
scanf("%lld",&n);
printf("%lld\n",((n%N)*((n+1)%N)-n%N)%N);
return 0;
}
C. Missing
思路:模拟题,Just write as the title says
注意 The lexicographical output is availablestring,因为可以直接sort
#include <bits/stdc++.h>
using namespace std;
const int N=110;
string s,ss[N],sss[N];
queue <int> q;
int main()
{
int n,i;
cin>>s;
cin>>n;
int len=s.length();
for(i=1;i<=n;i++)
{
cin>>ss[i];
}
int res=0;
for(i=1;i<=n;i++)
{
int k=ss[i].length();
if(k!=len)
continue;
int sum=0;
for(int j=0;j<len;j++)
{
if(ss[i][j]==s[j])
sum++;
}
if(res<sum)
{
res=sum;
while(!q.empty())
q.pop();
q.push(i);
}
else if(res==sum)
q.push(i);
}
if(res==0)
{
sort(ss+1,ss+1+n);
for(i=1;i<=n;i++)
cout<<ss[i]<<endl;
}
else
{
int sum=q.size();
i=1;
while(!q.empty())
{
sss[i]=ss[q.front()];
q.pop();
i++;
}
sort(sss+1,sss+1+sum);
for(i=1;i<=sum;i++)
cout<<sss[i]<<endl;
}
return 0;
}
D.Breezing
思路:The difference between each two numbers is the largest,Then just take it1或者bi,运用dp,The two cases are counted separately,Take the maximum value at the end
#include <bits/stdc++.h>
using namespace std;
const int N=100010;
typedef long long int ll;
int main()
{
ll n,i;
ll a[N],dp[N][3];//dp[i][1]表示第i个数取1的答案
cin>>n; //dp[i][2]表示第i个数取b[i]的答案
for(i=1;i<=n;i++) cin>>a[i];
dp[1][1]=0;
dp[1][2]=0;
for(i=2;i<=n;i++)
{
dp[i][1]=max(dp[i-1][1],dp[i-1][2]+a[i-1]-1);
dp[i][2]=max(dp[i-1][1]+a[i]-1,dp[i-1][2]+abs(a[i]-a[i-1]));
}
cout<<max(dp[n][1],dp[n][2])<<endl;
return 0;
}E.calling
思路:贪心思想,我们会发现,When the side length of the square is 6的时候,没有空余,边长是5的时候,会剩下11A cube that becomes one,边长为4时,会剩下5one becomes2的方块,以此类推,We fill each square,就是最好的情况.
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
ll t,k,n,s,i;
ll a[10];
cin>>t;
while(t--)
{
cin>>s;
for(i=1;i<=6;i++) cin>>a[i];
if(a[6]!=0)
s=s-a[6];
if(a[5]!=0)
{
s=s-a[5];
a[1]=a[1]-a[5]*11;
}
if(a[4]!=0)
{
s=s-a[4];
a[2]=a[2]-5*a[4];
if(a[2]<=0)
{
a[1]-=-a[2]*4;
a[2]=0;
}
}
if(a[3]!=0)
{
if(a[3]%4==0)
s=s-a[3]/4;
else
{
s=s-a[3]/4-1;
k=a[3]%4;
if(k==1)
{
if(a[2]>0)
{
a[2]=a[2]-5;
a[1]=a[1]-7;
}
else a[1]-=27;
if(a[2]<0)
{
a[1]-=-a[2]*4;
a[2]=0;
}
}
else if(k==2)
{
if(a[2]>0)
{
a[2]=a[2]-3;
a[1]=a[1]-6;
}
else a[1]-=18;
if(a[2]<0)
{
a[1]-=-a[2]*4;
a[2]=0;
}
}
else if(k==3)
{
if(a[2]>0)
{
a[2]=a[2]-1;
a[1]=a[1]-5;
}
else a[1]-=9;
if(a[2]<0)
{
a[1]-=-a[2]*4;
a[2]=0;
}
}
}
}
if(a[2]>0)
{
if(a[2]%9==0)
s=s-a[2]/9;
else
{
s=s-a[2]/9-1;
k=a[2]%9;
a[1]=a[1]-(9-k)*4;
}
}
if(a[1]>0)
{
if(a[1]%36==0)
s=s-a[1]/36;
else
s=s-a[1]/36-1;
}
//for(i=1;i<=6;i++)
//cout<<a[i]<<' ';
if(s>=0)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
return 0;
}
F题还没做,will make up
边栏推荐
- Android Studio 实现登录注册-源代码 (连接MySql数据库)
- WeChat reading, export notes
- Motion Tuned Spatio-temporal Quality Assessmentof Natural Videos
- C language: detailed explanation of operators
- 化二次型为标准型
- MySQL 删除表数据,重置自增 id 为 0 的两个方式
- MySQL的on duplicate key update 的使用
- 5分钟搞懂MySQL - 行转列
- 手把手教你搭建一台永久运行的个人服务器
- Babbitt | Metaverse Daily Must Read: The shuffling is coming, will the digital Tibetan industry usher in a new batch of leaders in the second half?Will there be new ways to play?...
猜你喜欢
![[The Beauty of Software Engineering - Column Notes] 31 | Is software testing responsible for product quality?](/img/6a/640763e3bd6c28f3e7fa762798b0ae.png)
[The Beauty of Software Engineering - Column Notes] 31 | Is software testing responsible for product quality?

MySQL----多表查询

C语言中指针没那么难~ (1)【文章结尾有资料】

使用map函数,对list中的每个元素进行操作 好像不用map

巴比特 | 元宇宙每日必读:洗牌将至,数藏行业下半场是否会迎来新一批领头羊?是否会出现新玩法?...

想要写出好的测试用例,先要学会测试设计

KingbaseES V8R6备份恢复案例之---同一数据库创建不同stanza备份

LeetCode·每日一题·952.按公因数计算最大组件大小·并查集

opencv,numpy,tensor格式转换

Cookie中的JSESSIONID说明
随机推荐
想要写出好的测试用例,先要学会测试设计
C语言中指针没那么难~(2)【文章结尾有资料】
Deep Non-Local Kalman Network for VideoCompression Artifact Reduction
ELF:加载过程
Generate OOM records in a production environment. Conclusion: Don't be lazy to query useless fields unless you are completely sure.
《快速掌握QML》第六章 动画
微信读书,导出笔记
MySQL60题作业
IDEA2018.3.5取消双击Shift快捷键
nVisual网络可视化管理平台功能和价值点
Use the map function to operate on each element in the list It seems that you don't need a map
KingbaseES TOAST存储方式
mysql死锁
MySQL60 homework
MySQL group_concat()详解
多线程获取官方汇率
HJ85 最长回文子串
vlan简单实验
Android Studio 实现登录注册-源代码 (连接MySql数据库)
awk notes