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. shell脚本 批量添加删除用户

    2021-07-26 1.批量添加用户 # 编写脚本 vi add_student_50.sh # 添加用户组 student groupadd student # 添加用户 student1-stu ...

  2. GUI容器之布局管理器

    布局管理器 布局管理器:frame.setLayout(); 默认值为new flowLayout() 流式布局 frame.setLayout(new FlowLayout(FlowLayout.R ...

  3. adb shell 查看当前与用户交互的 activity

    adb shell dumpsys activity activities | grep mActivityComponent

  4. 剑指 Offer 33. 二叉搜索树的后序遍历序列

    剑指 Offer 33. 二叉搜索树的后序遍历序列 输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历结果.如果是则返回 true,否则返回 false.假设输入的数组的任意两个数字都互不相同. ...

  5. 关于antd Select 限制选择个数的解决方案

    应用场景描述: Select 被form 所包裹,且被getFieldDecorator修饰.所以值的改变应该通过form的setFieldsValue方法. Select模式肯定会是multiple ...

  6. MySQL(一)——入门

    一.安装 二.配置环境变量 https://www.cnblogs.com/wzk153/category/1934516.html https://www.cnblogs.com/wzk153/ca ...

  7. SpringBoot异步使用@Async原理及线程池配置

    前言 在实际项目开发中很多业务场景需要使用异步去完成,比如消息通知,日志记录,等非常常用的都可以通过异步去执行,提高效率,那么在Spring框架中应该如何去使用异步呢 使用步骤 完成异步操作一般有两种 ...

  8. 在EXCEL中批量添加超链接

    在单元格中输入函数 =HYPERLINK(链接位置,[显示文本])

  9. CodeForce-782B The Meeting Place Cannot Be Changed(高精度二分)

    https://vjudge.net/problem/CodeForces-782B B. The Meeting Place Cannot Be Changed time limit per tes ...

  10. [NOIP2015 普及组] 扫雷游戏

    [NOIP2015 普及组] 扫雷游戏 难度:入门 题目描述 扫雷游戏是一款十分经典的单机小游戏.在nn行mm列的雷区中有一些格子含有地雷(称之为地雷格),其他格子不含地雷(称之为非地雷格).玩家翻开 ...