A - A

CodeForces - 136A

题解:按输入的顺序输出对应的下标即可,定义一个数组,将输入的作为下标,下标为值,最后依次输出即可;

#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

CodeForces - 136C

题解:先将数组排序,如果最大值不为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

CodeForces - 118A

题解:先将字符串中所有字符转换为小写字母,再在遍历时将元音赋值为 ‘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

CodeForces - 136B

#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补题的更多相关文章

  1. QFNU-ACM 2020.04.05个人赛补题

    A.CodeForces-124A (简单数学题) #include<cstdio> #include<algorithm> #include<iostream> ...

  2. LCCUP 2020 秋季编程大赛 补题

    果然是力扣杯,难度较于平时周赛提高了不少,个人感觉最后两题并不太容易QAQ LCP 18.早餐组合 #二分思想 题目链接 题意 你获得了每种主食的价格,及每种饮料的价格,你需要选择一份主食和一份饮料, ...

  3. 2020.10.23-vj个人赛补题

    B - B Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consistin ...

  4. 2020.10.16--vj个人赛补题

    D - Drinks Choosing Old timers of Summer Informatics School can remember previous camps in which eac ...

  5. Technocup 2020 - Elimination Round 1补题

    慢慢来. 题目册 题目 A B C D tag math strings greedy dp 状态 √ √ √ √ //∅,√,× 想法 A. CME res tp A 题意:有\(n\)根火柴,额外 ...

  6. 2021.5.22 vj补题

    A - Marks CodeForces - 152A 题意:给出一个学生人数n,每个学生的m个学科成绩(成绩从1到9)没有空格排列给出.在每科中都有成绩最好的人或者并列,求出最好成绩的人数 思路:求 ...

  7. 2021-5-15 vj补题

    C - Win or Freeze CodeForces - 151C 题目内容: You can't possibly imagine how cold our friends are this w ...

  8. 2020.12.3--vj个人赛补题

    A Vasya studies music.He has learned lots of interesting stuff. For example, he knows that there are ...

  9. 2020.10.30--vj个人赛补题

    D - D CodeForces - 743A Vladik is a competitive programmer. This year he is going to win the Interna ...

  10. 2020.10.9--vj个人赛补题

    B - A Tide of Riverscape 题意:给出一组字符串,由'0','1',' . '组成,' . '可以换成 0或1,判断第 i  个和第 i+p 个字符是否可以不相等,如果可以则输出 ...

随机推荐

  1. minicom-linux下USB转串口配置

    现在的笔记本越做越薄,好些电脑已经没有串口了,做硬件开发会非常头疼,不过有了USB转串口设备,PC机只需要有USB接口就可以了.在linux下我们使用minicom与目标设备通信,在此记录一下linu ...

  2. Caffe 快速入门笔记

    官网:http://caffe.berkeleyvision.org/ 其中包含Notebook Example方便入门学习 只是使用她的库还是比较简单,其难点在于: 安装 源码 训练好的模型,用于迁 ...

  3. win+R 中的命令

    cmd------CMD命令提示符 MSConfig------系统配置实用程序 regedit------注册表编辑器 notepad------打开记事本 calc------启动计算器 msts ...

  4. struts2的初步认识

    Struts2是一个基于MVC设计模式的Web应用框架,它本质上相当于一个servlet,在MVC设计模式中,Struts2作为控制器(Controller)来建立模型与视图的数据交互. 一. Str ...

  5. 前后端数据交互(五)——什么是 axios?

    一.什么是 axios ? axios是基于 Promise 的 ajax 封装库,也是前端目前最流行的 ajax 请求库.简单地说发送 get.post 请求,是一个轻量级的库,使用时可直接引入. ...

  6. 网络层协议、ARP攻击

    一.IP数据包格式 二.ICMP协议介绍 PING命令 三.ARP协议介绍 四.ARP攻击原理 一.IP数据包格式 网络层的功能 定义了基于IP协议的逻辑地址 连接不同的媒介类型 选择数据通过网络的最 ...

  7. ElasticSearch集成SpringData史上最全查询教程

    1.简单介绍 springboot 使用springdata操作es,ElasticsearchRepository使用QueryBuilder构造查询条件 2.集成es //maven集成 < ...

  8. RocketMQ详解(一)原理概览

    专题目录 RocketMQ详解(一)原理概览 RocketMQ详解(二)安装使用详解 RocketMQ详解(三)启动运行原理 RocketMQ详解(四)核心设计原理 RocketMQ详解(五)总结提高 ...

  9. Docker安装mysql镜像并进行主从配置

    Docker安装mysql镜像并进行主从配置 1.下载需要的mysql版本镜像 docker pull mysql:5.6 2.启动mysql服务实例(基本启动) #启动主mysql docker r ...

  10. python中字典按键、值进行排序

    看到排序,就不禁想起python中的sort和sorted sort是列表中的方法,用于对列表进行排序(改变的是原列表,不返回新列表) 用法: list.sort(key=None,reverse=T ...