【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;
}
【codeforces 796A】Buying A House的更多相关文章
- 【codeforces 103E】 Buying Sets
http://codeforces.com/problemset/problem/103/E (题目链接) 题意 给出$n$个数,每个数与一个集合相关联.从其中选出最小的若干个数,选出的数的个数与这些 ...
- 【codeforces 415D】Mashmokh and ACM(普通dp)
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...
- 【codeforces 799B】T-shirt buying
[题目链接]:http://codeforces.com/contest/799/problem/B [题意] 告诉你每个人喜欢的衣服的颜色; 然后告诉你每件衣服的正面和背面的颜色以及它的价格; 只要 ...
- 【15.07%】【codeforces 625A】Guest From the Past
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- 【codeforces 762B】USB vs. PS/2
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 【codeforces 707E】Garlands
[题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...
- 【codeforces 707C】Pythagorean Triples
[题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...
- 【codeforces 709D】Recover the String
[题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...
- 【codeforces 709B】Checkpoints
[题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...
随机推荐
- PCB 第一个node.js应用
一.Node安装地址: https://nodejs.org/zh-cn/ 二.Node第一个应用实例 启动webnode.js应用: node webnode.js webnode.js代码: va ...
- Rails mysql数据库连接的小坑
基本上直接clone下来的话,数据库连接必失败. 注意,把用户名密码写在.env文件下
- Countries in War(强连通分量及其缩点)
http://poj.org/problem?id=3114 题意:有n个城市,m条边,由a城市到b城市的通信时间为w,若a城市与b城市连通,b城市与a城市也连通,则a,b城市之间的通信时间为0,求出 ...
- Django day26 HyperlinkedIdentityField,序列化组件的数据校验以及功能的(全局,局部)钩子函数,序列化组件的反序列化和保存
一:HyperlinkedIdentityField(用的很少):传三个参数:第一个路由名字,用来反向解析,第二个参数是要反向解析的参数值,第三个参数:有名分组的名字 -1 publish = ser ...
- ORA-01075: you are currently logged on
[root@hear01 ~]# su - oracle[oracle@hear01 ~]$ sqlplus "/as sysdba" SQL*Plus: Release 11.2 ...
- hdu2026(water~~)
http://acm.hdu.edu.cn/showproblem.php?pid=2026 #include<iostream> #include<stdio.h> #inc ...
- scala控制流程语句
直接上代码了哈. package com.test.scala.test object Kongzi { def main(args: Array[String]): Unit = { //if 语句 ...
- [转]使用ThinkPHP框架快速开发网站(多图)
本文转自:http://blog.csdn.net/ruby97/article/details/7574851 这一周一直忙于做实验室的网站,基本功能算是完成了.比较有收获的是大概了解了ThinkP ...
- MySQL关于视图的创建
-- 视图就是一条select 语句 执行后返回结果集,是一种虚拟表,是一个逻辑表 -- 方便操作,减少复杂的SQL语句,增加可读性,更加安全一些 create view demo_view as s ...
- 我的github教程
这篇文章记录个人常用的一些命令,和记不住的一些命令. 安装 在 Windows 上安装 Git ,有个叫做 msysGit 的项目提供了安装包: http://msysgit.github.io/ 完 ...