Problem A:题目传送门

题目大意:给你N家店,每家店有不同的价格卖苹果,ai元bi斤,那么这家的苹果就是ai/bi元一斤,你要买M斤,问最少花多少元。

题解:贪心,找最小的ai/bi。

#include <cstdio>
using namespace std;
double minn=2e9,x,y,M;
int N; int read()
{
char c;while(c=getchar(),c<''||c>'');
int x=c-'';while(c=getchar(),c>=''&&c<='')x=x*+c-'';
return x;
} inline double min(double x,double y){return x<y?x:y;} int main()
{
N=read(),M=read();
for(int i=;i<=N;i++){
x=read(),y=read();
minn=min(minn,M*x/y);
}
printf("%.8lf",minn);
return ;
}

Problem A

Problem B:题目传送门

题目大意:给一个数字K,求一个第K大的Perfect数,Perfect数指这个数数位上的数字之和为10。

题解:DFS即可。

#include <cstdio>
#include <cstdlib>
using namespace std; int K,cnt=,a[]; void print(int tot)
{
for(int i=;i<=tot;i++)putchar(a[i]+'');
return ;
} void search(int tot,int now,int less)
{
if(now==tot){
cnt++;
if(cnt==K){print(tot);exit();}
return ;
}
if(now==tot-){a[tot]=less;search(tot,tot,);return ;}
for(int i=;i<=less;i++){
a[now+]=i;
search(tot,now+,less-i);
}
return ;
} int main()
{
scanf("%d",&K);
register int i,j;
for(i=;i<=;i++){
for(j=;j<=;j++){
a[]=j;
search(i,,-j);
}
}
return ;
}

Problem B

Problem C:题目传送门

题目大意:给三个整数N,M,K,表示图的大小为N*M,求能坐的座位有连续K个的方案数。‘*’表示不能坐,“.”表示能坐。

题解:预处理每个点横着有连续几个,竖着有连续几个,然后找到一段连续的最大的点ans+=min(0,W-K+1)。W为这个点的值。K为一时特判,答案为所有能坐的位置总和。

#include <cstdio>
#include <algorithm>
using namespace std; int N,M,K,ans,cnt;
int a[][];
int ri[][],di[][]; int main()
{
scanf("%d%d%d",&N,&M,&K);
register int i,j;
for(i=;i<=N;i++){getchar();
for(j=;j<=M;j++){
char c=getchar();
if(c=='.')a[i][j]=,cnt++;
}
}
if(K==)return printf("%d",cnt),;
for(i=;i<=N;i++)
for(j=;j<=M;j++)
if(a[i][j])ri[i][j]=ri[i][j-]+,di[i][j]=di[i-][j]+;
for(i=;i<=N;i++)
for(j=;j<=M+;j++){
if(!a[i][j])ans+=(max(,ri[i][j-]-K+));
}
for(j=;j<=M;j++)
for(i=;i<=N+;i++){
if(!a[i][j])ans+=(max(,di[i-][j]-K+));
}
printf("%d",ans);
return ;
}

Problem C

Codeforces Round #460 (Div. 2) 前三题的更多相关文章

  1. Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2) (前三题题解)

    这场比赛好毒瘤哇,看第四题好像是中国人出的,怕不是dllxl出的. 第四道什么鬼,互动题不说,花了四十五分钟看懂题目,都想砸电脑了.然后发现不会,互动题从来没做过. 不过这次新号上蓝名了(我才不告诉你 ...

  2. Codeforces Round #609 (Div. 2)前五题题解

    Codeforces Round #609 (Div. 2)前五题题解 补题补题…… C题写挂了好几个次,最后一题看了好久题解才懂……我太迟钝了…… 然后因为longlong调了半个小时…… A.Eq ...

  3. BestCoder Round #11 (Div. 2) 前三题题解

    题目链接: huangjing hdu5054 Alice and Bob 思路: 就是(x,y)在两个參考系中的表示演全然一样.那么仅仅可能在这个矩形的中点.. 题目: Alice and Bob ...

  4. Codeforces Round #195 A B C 三题合集 (Div. 2)

    A 题 Vasily the Bear and Triangle 题目大意 一个等腰直角三角形 ABC,角 ACB 是直角,AC=BC,点 C 在原点,让确定 A 和 B 的坐标,使得三角形包含一个矩 ...

  5. Codeforces Round #416 (Div. 2)(A,思维题,暴力,B,思维题,暴力)

    A. Vladik and Courtesy time limit per test:2 seconds memory limit per test:256 megabytes input:stand ...

  6. Codeforces Round #590 (Div. 3)【D题:26棵树状数组维护字符出现次数】

    A题 题意:给你 n 个数 , 你需要改变这些数使得这 n 个数的值相等 , 并且要求改变后所有数的和需大于等于原来的所有数字的和 , 然后输出满足题意且改变后最小的数值. AC代码: #includ ...

  7. Codeforces Round #590 (Div. 3)【D题:维护26棵树状数组【好题】】

    A题 题意:给你 n 个数 , 你需要改变这些数使得这 n 个数的值相等 , 并且要求改变后所有数的和需大于等于原来的所有数字的和 , 然后输出满足题意且改变后最小的数值. AC代码: #includ ...

  8. Codeforces Round #310 (Div. 2)--A(简单题)

    http://codeforces.com/problemset/problem/556/A 题意:给一个01字符串,把所有相邻的0和1去掉,问还剩下几个0和1. 题解:统计所有的0有多少个,1有多少 ...

  9. Codeforces Round #336 (Div. 2)-608A.水题 608B.前缀和

    A题和B题...   A. Saitama Destroys Hotel time limit per test 1 second memory limit per test 256 megabyte ...

随机推荐

  1. navicat远程连接mysql,2003 can't connect to mysql server on 10038

    转载地址:https://blog.csdn.net/f12105212/article/details/70768516 1:我们连接远程服务器的mysql,如果出现问题,很大问题会出在服务器的端口 ...

  2. 关于HiddenHttpMethodFilter

    这个类的代码比较少,所以把整个类的代码都复制过来.在注释中添加上自己的理解. public class HiddenHttpMethodFilter extends OncePerRequestFil ...

  3. What is Systems Architecture ?

    What is Systems Architecture ?   Systems Architecture is a generic discipline to handle objects (exi ...

  4. android 智能提示

    <AutoCompleteTextView android:id="@+id/autoCompleteTextView" android:completionThreshol ...

  5. JsonHelp

    using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using System; u ...

  6. select下拉框之默认选项清空

    最近和小伙伴发现,select默认选项一般是提示信息,怎么才能让当我们点击下拉框时,可选的选项中没有默认的提示信息呢? 思路: 1.当点击下拉框时,让默认提示信息,即下拉框第一个选项移除. 2.当没有 ...

  7. if __name__ == "__main__"如何正确理解

    粗略来讲,__name__是当前模块,当模块被直接运行时模块名为__main__.这句话的意思是,当模块被直接执行时,代码将运行,当模块是被导入时,代码不被运行 例如,执行one.py # file ...

  8. iview中table里嵌套i-switch、input、select等

    iview中table内嵌套 input render:(h,params) => { return h('Input',{ props: { value:'', size:'small', } ...

  9. PAT——1004. 成绩排名

    原题目:https://www.patest.cn/contests/pat-b-practise/1004 读入n名学生的姓名.学号.成绩,分别输出成绩最高和成绩最低学生的姓名和学号. 输入格式:每 ...

  10. EDA风格与Reactor模式

    本文将探讨如下几个问题: Event-Driven架构风格的约束 EDA风格对架构属性的影响 Reactor架构模式 Reactor所解决的问题 redis中的EventDriven 从观察者模式到E ...