2020.11.6-vj补题
A - A
题解:按输入的顺序输出对应的下标即可,定义一个数组,将输入的作为下标,下标为值,最后依次输出即可;
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int s[n+5],i,a;
for(i=1;i<=n;i++)
{
cin>>a;
s[a]=i;
}
for(i=1;i<=n;i++)
{
if(i==1)cout<<s[i];
else cout<<" "<<s[i];
}
cout<<endl;
}
C - C
题解:先将数组排序,如果最大值不为1,则将其设为1,否则设为2,在进行一次排序,输出即可
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long n;
cin>>n;
long long s[n+5],i;
for(i=0;i<n;i++)
{
scanf("%lld",&s[i]);
}
sort(s,s+n);
if(s[n-1]!=1)s[n-1]=1;
else s[n-1]=2;
sort(s,s+n);
for(i=0;i<n;i++)
{
if(i==0)printf("%lld",s[i]);
else printf(" %lld",s[i]);
}
cout<<endl;
}
D - D
题解:先将字符串中所有字符转换为小写字母,再在遍历时将元音赋值为 ‘0’,输出时不为‘0’的就直接输出“.”+字母即可
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int n;
n=s.size();
for(int i=0;i<n;i++)
{
if(s[i]>='A'&&s[i]<='Z')s[i]+=32;
if(s[i]=='a'||s[i]=='o'||s[i]=='e'||s[i]=='y'||s[i]=='u'||s[i]=='i')s[i]='0'; }
for(int i=0;i<n;i++)
{
if(s[i]!='0')cout<<"."<<s[i];
}
cout<<endl;
}
E - E
CodeForces - 118B
题解:先输出上半部分(n+1)行,第一行空格为n*2个,随后每行空格数减一,每行从0还是输出直到该行数i-1为止,在从i-1输出到0换行,同理输出
下半部分先根据上半部分计算出下半部分第一行的空格数输出,然后每行空格数加2,依照上半部分同理输出即可
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int m=n;
int w;
for(int i=1;i<=n+1;i++)
{
for(int j=0;j<m*2;j++)cout<<" ";
m-=1;
for( w=0;w<i;w++)
{
if(w==0)cout<<w;
else cout<<" "<<w;
}
if(w==0)cout<<endl;
else
{
for(int q=w-2;q>=0;q--)
{
if(q==w-1)cout<<q;
else cout<<" "<<q;
}
cout<<endl;
}
}
//cout<<m<<endl; m+=2;
for(int i=n;i>=1;i--)
{
for(int j=0;j<=m;j++)cout<<" ";
m+=2;
for(w=0;w<=i-1;w++)
{
if(w==0)cout<<w;
else cout<<" "<<w;
}
if(w==0)cout<<endl;
else
{
for(int q=w-2;q>=0;q--)
{
if(q==w-1)cout<<q;
else cout<<" "<<q;
}
cout<<endl;
}
}
}
B - B
#include<bits/stdc++.h>
using namespace std;
int main()
{
long a,c,ct=0,i=0;
scanf("%ld%ld",&a,&c);
while(a!=0 || c!=0)
{
ct+=(c%3-a%3+3)%3*pow(3,i);//**/
a/=3;
c/=3;
i++;
}
printf("%ld\n",ct);
return 0;
}
2020.11.6-vj补题的更多相关文章
- QFNU-ACM 2020.04.05个人赛补题
A.CodeForces-124A (简单数学题) #include<cstdio> #include<algorithm> #include<iostream> ...
- LCCUP 2020 秋季编程大赛 补题
果然是力扣杯,难度较于平时周赛提高了不少,个人感觉最后两题并不太容易QAQ LCP 18.早餐组合 #二分思想 题目链接 题意 你获得了每种主食的价格,及每种饮料的价格,你需要选择一份主食和一份饮料, ...
- 2020.10.23-vj个人赛补题
B - B Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consistin ...
- 2020.10.16--vj个人赛补题
D - Drinks Choosing Old timers of Summer Informatics School can remember previous camps in which eac ...
- Technocup 2020 - Elimination Round 1补题
慢慢来. 题目册 题目 A B C D tag math strings greedy dp 状态 √ √ √ √ //∅,√,× 想法 A. CME res tp A 题意:有\(n\)根火柴,额外 ...
- 2021.5.22 vj补题
A - Marks CodeForces - 152A 题意:给出一个学生人数n,每个学生的m个学科成绩(成绩从1到9)没有空格排列给出.在每科中都有成绩最好的人或者并列,求出最好成绩的人数 思路:求 ...
- 2021-5-15 vj补题
C - Win or Freeze CodeForces - 151C 题目内容: You can't possibly imagine how cold our friends are this w ...
- 2020.12.3--vj个人赛补题
A Vasya studies music.He has learned lots of interesting stuff. For example, he knows that there are ...
- 2020.10.30--vj个人赛补题
D - D CodeForces - 743A Vladik is a competitive programmer. This year he is going to win the Interna ...
- 2020.10.9--vj个人赛补题
B - A Tide of Riverscape 题意:给出一组字符串,由'0','1',' . '组成,' . '可以换成 0或1,判断第 i 个和第 i+p 个字符是否可以不相等,如果可以则输出 ...
随机推荐
- 修改anaconda3 jupyter notebook 默认路径
本文参考了: https://blog.csdn.net/u014552678/article/details/62046638 https://blog.csdn.net/qigenhuochai/ ...
- centos7 查看端口占用情况
2021-08-02 1. 查看端口占用情况 # 查看 8088 端口占用情况 lsof -i tcp:8088 # 若提示没有 lsof 命令, yum 安装一下 yum -y install ls ...
- Robot framework随机文件
*** Variables *** @{Example} One Two Three *** Test Cases *** Example ${value}= Evaluate random.choi ...
- Appium问题解决方案(6)- Java堆栈错误:java.lag.ClassNotFoundException:org.eclipse.swt.widets.Control
背景 运行脚本出现 SWT folder '..\lib\location of your Java installation.' does not exist. Please set ANDROID ...
- Mysql常用sql语句(6)- limit 限制查询结果的条数
测试必备的Mysql常用sql语句系列 https://www.cnblogs.com/poloyy/category/1683347.html 前言 实际工作中,我们的数据表数据肯定都是万级别的,如 ...
- Identity用户管理入门七(扩展用户字段)
在实际使用时会发现很多字段在IdentityUser中并不存在,比如增加生日,地址等字段,可在模型类中实现自己的模型并继承自IdentityUser,需要修改的代码为以下类 一.新增模型 using ...
- CSS002. 字体穿透蒙层(用img设置字体的color)
之前在逛Apple Store时看到了下面的UI: 交互图标非常圆滑上手也很舒服,虽然背景底色本就是白底,但是只依赖css能不能使 "+" 穿透背景看到底色 ? 大致思路如下: ...
- Windows中nginx多次启动的问题
在Windows上做开发环境中的nginx服务器.为了使nginx在后台运行,使用如下命令来启停nginx: cd <nginx安装目录> # 开启nginx并在后台运行 start ng ...
- 物理机burp抓虚拟机包
先设置网络连接为NAT模式. 这就相当于主机虚拟出一个网卡,虚拟机单独成为一个网段(相当于虚拟机为单独一台主机,物理机作为路由器网关使用),我将会在物理机,也就是这个"路由器"上设 ...
- HDU2647Reward (拓扑排序)
Reward Description Dandelion's uncle is a boss of a factory. As the spring festival is coming , he w ...