A. Stock Arbitraging

直接上代码:

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
#include<cmath> const int maxn=1e5+;
typedef long long ll;
using namespace std; int main()
{ int n,m,r;
cin>>n>>m>>r;
int x;
int minn=0x3f3f3f3f;
for(int t=;t<n;t++)
{
scanf("%d",&x);
minn=min(minn,x);
}
int maxnn=;
for(int t=;t<m;t++)
{
scanf("%d",&x);
maxnn=max(maxnn,x);
}
if(maxnn<=minn)
{
cout<<r<<endl;
}
else
{
int k=r;
r=r%minn;
r+=(maxnn)*(k/minn);
cout<<r<<endl;
} return ;
}

B. Tiling Challenge

找一下就行了

代码:

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
#include<cmath> const int maxn=1e5+;
typedef long long ll;
using namespace std;
char Map[][];
int n;
int dir[][]={{,},{,-},{-,},{,}};
bool check(int x,int y)
{
if(x>=&&x<n&&y>=&&y<n)
{
return true;
}
else
{
return false;
}
}
int main()
{ cin>>n;
getchar();
for(int t=;t<n;t++)
{
scanf("%s",Map[t]);
}
for(int t=;t<n;t++)
{
for(int j=;j<n;j++)
{
int sum=;
if(Map[t][j]=='.')
{
for(int k=;k<;k++)
{
int xx=t+dir[k][];
int yy=j+dir[k][];
//cout<<xx<<" "<<yy<<endl;
if(check(xx,yy)&&Map[xx][yy]=='.')
{
sum++;
}
}
}
if(sum==)
{
Map[t][j]='#';
for(int k=;k<;k++)
{
int xx=t+dir[k][];
int yy=j+dir[k][];
Map[xx][yy]='#';
}
}
}
}
bool flag=true;
for(int t=;t<n;t++)
{
for(int j=;j<n;j++)
{
if(Map[t][j]=='.')
{
flag=false;
}
}
}
if(flag)
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
return ;
}

C. Prefix Sum Primes

思维+构造也很好想

代码;

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
#include<cmath> const int maxn=1e5+;
typedef long long ll;
using namespace std;
vector<int>v1,v2;
int main()
{
int n;
cin>>n;
int x;
for(int t=;t<n;t++)
{
scanf("%d",&x);
if(x==)
v1.push_back(x);
else
{
v2.push_back(x);
}
} if(v1.size()==n)
{
vector<int>::iterator it=v1.begin();
for(it=v1.begin();it!=v1.end();it++)
{
cout<<*it<<" ";
}
}
else if(v2.size()==n)
{
vector<int>::iterator it=v2.begin();
for(it=v2.begin();it!=v2.end();it++)
{
cout<<*it<<" ";
}
}
else
{
cout<<"2 1 ";
int xx=v1.size()-;
int yy=v2.size()-;
for(int t=;t<yy;t++)
{
cout<<"2 ";
}
for(int j=;j<xx;j++)
{
cout<<"1 ";
} }
return ;
}

Codeforces Round #556 (Div. 2)-ABC(这次的题前三题真心水)的更多相关文章

  1. Codeforces Round #556 (Div. 2) - C. Prefix Sum Primes(思维)

    Problem  Codeforces Round #556 (Div. 2) - D. Three Religions Time Limit: 1000 mSec Problem Descripti ...

  2. Codeforces Round #556 (Div. 2) - D. Three Religions(动态规划)

    Problem  Codeforces Round #556 (Div. 2) - D. Three Religions Time Limit: 3000 mSec Problem Descripti ...

  3. Codeforces Round #556 (Div. 1)

    Codeforces Round #556 (Div. 1) A. Prefix Sum Primes 给你一堆1,2,你可以任意排序,要求你输出的数列的前缀和中质数个数最大. 发现只有\(2\)是偶 ...

  4. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  5. Codeforces Round #247 (Div. 2) ABC

    Codeforces Round #247 (Div. 2) http://codeforces.com/contest/431  代码均已投放:https://github.com/illuz/Wa ...

  6. Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)

    Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...

  7. Codeforces Round #556 (Div. 2)

    比赛链接 A 贪心 #include <cstdlib> #include <cstdio> #include <algorithm> #include <c ...

  8. Codeforces Round #313 (Div. 2) ABC

    A http://codeforces.com/contest/560/problem/A 推断给出的数能否组成全部自然数. 水题 int a[1010]; bool b[1000010]; int ...

  9. Codeforces Round #556 (Div. 2) D. Three Religions 题解 动态规划

    题目链接:http://codeforces.com/contest/1150/problem/D 题目大意: 你有一个参考串 s 和三个装载字符串的容器 vec[0..2] ,然后还有 q 次操作, ...

随机推荐

  1. Spring JMX之一:使用JMX管理Spring Bean

    spring中关于jmx包括几个概念: MBeanExporter: 从字面上很容易理解, 用来将一些spring的bean作为MBean暴露给MBEanServer.MBeanServerFacto ...

  2. view是视图层+action是控制层+service是业务层+dao是数据访问层。

  3. 看图说说Sun HotSpot虚拟机对象

  4. MySQL性能调优与架构设计——第11章 常用存储引擎优化

    第11章 常用存储引擎优化 前言: MySQL 提供的非常丰富的存储引擎种类供大家选择,有多种选择固然是好事,但是需要我们理解掌握的知识也会增加很多.每一种存储引擎都有各自的特长,也都存在一定的短处. ...

  5. angularjs 之 $watch

    双向绑定是Angular的核心概念之一,它给我们带来了思维方式的转变:不再是DOM驱动,而是以Model为核心,在View中写上声明式标签.然后,Angular就会在后台默默的同步View的变化到Mo ...

  6. 使用zookeeper自带的zkCli.sh客户端工具实现对zk的CURD常见操作详解

    一.zookeeper自带的 zkCli.sh 客户端工具 1. 应急和测试使用到的一个工具. 还有C# dirver java dirver (驱动)   二.driver的使用方式有两种 zkCl ...

  7. Android-画板

    在上一篇博客,Android-图像原理/绘制原理,讲解到绘图原理中,画布 + 画笔

  8. 学生信息系统(json模块解决数据持久化)

    将学生管理的案例,学生信息由原来的只有姓名,拓展为包含,姓名,年龄,两个属性:完成对应的增.删.查.改,操作 import json,os,time,sys student_list = [] Fil ...

  9. visual studio code中使用emmet插件在.vue文件失效

    使用visual studio code编辑.vue文件时,emmet插件无法使用,可以通过以下两种试解决: 1.文件→设置,在右侧窗口添加以下代码: "emmet.syntaxProfil ...

  10. IPA文件的自动化生成和无线分发

    1. IPA的无线分发 iOS应用开发测试过程中,通过无线网络进行IPA包的分发将是非常便捷的,于是也就有了类似testflightapp之类的平台.对于这一功能,我们也可以自己实现,只需要一个简单的 ...