【codeforces 796A】Buying A House
【题目链接】:http://codeforces.com/contest/796/problem/A
【题意】
让你选一个最靠近女票的,且能买的房子;
输出你和你女票的距离;
【题解】
枚举
【Number Of WA】
0
【完整代码】
#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define ps push_back
#define fi first
#define se second
#define rei(x) scanf("%d",&x)
#define rel(x) scanf("%lld",&x)
#define ref(x) scanf("%lf",&x)
#define ms(x,y) memset(x,y,sizeof x)typedef pair<int,int> pii;
typedef pair<LL,LL> pll;const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 110;int n,m,k,mi = -1;
int a[N];int main()
{//freopen("F:\\rush.txt","r",stdin);rei(n),rei(m),rei(k);rep1(i,1,n)rei(a[i]);rep1(i,1,n)if (a[i]>0 && k>=a[i]){if (mi==-1 || abs(m-i)*10<mi){mi = abs(m-i)*10;}}cout << mi << endl;//printf("\n%.2lf sec \n", (double)clock() / CLOCKS_PER_SEC);return 0;
}
转载于:https://www.cnblogs.com/AWCXV/p/7626458.html
【codeforces 796A】Buying A House相关推荐
- 【codeforces 103E】 Buying Sets
http://codeforces.com/problemset/problem/103/E (题目链接) 题意 给出$n$个数,每个数与一个集合相关联.从其中选出最小的若干个数,选出的数的个数与这些 ...
- 【CodeForces - 144C】Anagram Search(尺取,滑窗问题,处理字符串计数)
题干: A string t is called an anagram of the string s, if it is possible to rearrange letters in t so ...
- 【CodeForces - 574B】Bear and Three Musketeers (枚举边,思维,优秀暴力)
题干: Do you know a story about the three musketeers? Anyway, you will learn about its origins now. Ri ...
- 【CodeForces - 608C】Chain Reaction (二分 或 dp ,思维)
题干: 题目大意: 题意是在一条直线上坐落着不同位置的灯塔,每一个灯塔有自己的power level,当作是射程范围.现在从最右边的灯塔开始激发,如果左边的灯塔在这个灯塔的范围之内,那么将会被毁灭.否 ...
- 「一题多解」【CodeForces 85D】Sum of Medians(线段树 / 分块)
题目链接 [CodeForces 85D]Sum of Medians 题目大意 实现一个setsetset,支持插入,删除,求∑a5k+3∑a5k+3\sum a_{5k+3}.注意,setsets ...
- 【CodeForces 997C】Sky Full of Stars(组合计数)
题目链接:[CodeForces 997C]Sky Full of Stars 官方题解:Codeforces Round #493 - Editorial 题目大意:有一个n×nn×nn\times ...
- 【codeforces 812C】Sagheer and Nubian Market
[题目链接]:http://codeforces.com/contest/812/problem/C [题意] 给你n个物品; 你可以选购k个物品;则 每个物品有一个基础价值; 然后还有一个附加价值; ...
- 【codeforces 508B】Anton and currency you all know
[题目链接]:http://codeforces.com/contest/508/problem/B [题意] 给你一个奇数; 让你交换一次数字; 使得这个数字变成偶数; 要求偶数要最大; [题解] ...
- 【codeforces 711B】Chris and Magic Square
[题目链接]:http://codeforces.com/contest/711/problem/B [题意] 让你在矩阵中一个空白的地方填上一个正数; 使得这个矩阵两个对角线上的和; 每一行的和,每 ...
最新文章
- 云计算应用还有不少的障碍尚需解决
- 华为云计算基础-华为云计算套件
- java 容器_JAVA的容器
- 分布式文件系统之Hdfs是什么?
- Ybt#452-序列合并【期望dp】
- 中国首部智能交通微纪录片正式发布 探讨交通强国高质量发展路径
- asm 查看 数据文件 修改 时间_Oracle的ASM介绍及管理
- 故宫首开夜场门票秒空官网崩溃:7本书让网站挺住
- C#Const与static readonly的区别
- mybatis整合spring,使用org.mybatis.spring.mapper.MapperScannerConfigurer扫描出现问题
- R 学习笔记《四》 R语言初学者指南--载入数据
- 高清卫星影像DEM数据免费下载,3款软件4个网站推荐收藏!
- Fréchet Inception Distance(FID)
- 信度spss怎么做_实用干货!信度分析超全步骤总结!
- Supervisor 使用说明,轻松管理进程
- 专访马化腾:首次开谈个人经历、管理心得、技术创新、微信的诞生等
- 【愚公系列】2022年10月 微信小程序-电商项目-商品详情页面的标题及价格功能实现
- 曼昆经济学原理读书笔记加杂感(一)
- 未来无生经超级计算机,第三十二章 有些鸡肋的未来无生经
- 2021年登高架设模拟考试题及登高架设复审模拟考试