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. Ubuntu 16.04 NVidia显卡 输入密码后 重复出现登录界面

    问题根源:显卡驱动 解决办法: CTRL+ALT+F1 # 切换到命令行 sudo service lightdm stop  # 关闭桌面显示管理器 sudo apt-get remove --pu ...

  2. 在已有Win7/10系统电脑中加装Ubuntu18.04(安装双系统)

    准备一台有Win7/10的电脑. 为Ubuntu预留硬盘空间.最好在硬盘最后保留一个空闲分区.(Ubuntu会自动安装到后面的空闲分区) 用Universal USB Installer制作安装盘(U ...

  3. MySQL-表迁移工具的选型-xtrabackup的使用

    1.1. 场景 有的时候test人员可能需要在测试库上比较新的数据,这时候只能是从生产库上面去那了.如果是小表还好实用mysqldump/mysqlpump就可以轻松的解决.但是,如果遇到了大表这将是 ...

  4. 存储系统管理(一)——Linux系统的设备和分区管理

    1.设备名称的理解 /dev/sda1? sata硬盘,a1表示第一块硬盘中的第一个分区 /dev/cdrom 光驱 /dev/mapper/*? 系统中的虚拟设备 2.发现系统中的设备 ? fdis ...

  5. python 动图gif合成与分解

    合成 #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import imageio def main(imgs_ ...

  6. thymeleaf+layui加载页面渲染时报错

    将freemaker替换成thymeleaf时出现以下问题: org.thymeleaf.exceptions.TemplateProcessingException: Could not parse ...

  7. 前端使用a标签启动本地.exe程序

    目录 1,需求 2,效果图 3,实现原理 4,代码 5,注意事项 1,需求 最近有一个需求,在web页面上有一个按钮,点击按钮,调起本地的.exe程序客户端,我在网上找了很多,感觉都不完整,所以自己总 ...

  8. 【SpringMVC】文件上传与下载、拦截器、异常处理器

    文件下载 使用ResponseEntity实现下载文件的功能 index.html <!DOCTYPE html> <html lang="en" xmlns:t ...

  9. 源码编译安装nginx及设置开机启动项

    1.上传nginx文档:解压到/data目录下,并安装依赖包tar xf nginx-1.20.1.tar.gz -C /data/cd /data/nginx-1.20.1/ && ...

  10. MapperScannerConfigurer之sqlSessionFactoryBeanName注入方式

    Spring整合Mybatis时,项目启动时报错:(MapperScannerConfigurer之sqlSessionFactoryBeanName注入方式) pringframework.bean ...