Discrete Function(简单数学题)
Discrete Function
Input
Output
Example
| input | output |
|---|---|
3 |
1 2 |
//简单数学题,题意是,在一个横坐标是 1 - N 的整数的坐标里,每个整数代表纵坐,若任意两个点都可连成一条直线,问倾角最大的两个点横坐标是?
//容易想到,必须是两个相邻的点才有可能倾角最大,所以一重循环就解决了
#include<stdio.h>
#include<math.h>
double a[];
int main()
{
int n; scanf("%d",&n);
for(int i=;i<=n;i++) scanf("%lf",&a[i]); int s=,e=;
double ans=-;
for(int i=;i<=n;i++)
{
double tmp=fabs(a[i]-a[i-]);
if(ans<tmp)
{
s=i-;
e=i;
ans=tmp;
}
}
printf("%d %d\n",s,e);
return ;
}
Discrete Function(简单数学题)的更多相关文章
- URAL 1010 Discrete Function【简单暴力】
链接: http://acm.timus.ru/problem.aspx?space=1&num=1010 http://acm.hust.edu.cn/vjudge/contest/vie ...
- Ural 1010. Discrete Function
1010. Discrete Function Time limit: 1.0 secondMemory limit: 64 MB There is a discrete function. It i ...
- HDU 6467 简单数学题 【递推公式 && O(1)优化乘法】(广东工业大学第十四届程序设计竞赛)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6467 简单数学题 Time Limit: 4000/2000 MS (Java/Others) M ...
- HDU 6467.简单数学题-数学题 (“字节跳动-文远知行杯”广东工业大学第十四届程序设计竞赛)
简单数学题 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submi ...
- JZOJ 5773. 【NOIP2008模拟】简单数学题
5773. [NOIP2008模拟]简单数学题 (File IO): input:math.in output:math.out Time Limits: 1000 ms Memory Limits ...
- [JZOJ5773]【NOIP2008模拟】简单数学题
Description 话说, 小X是个数学大佬,他喜欢做数学题.有一天,小X想考一考小Y.他问了小Y一道数学题.题目如下: 对于一个正整数N,存在一个正整数T(0<T&l ...
- geometry(简单数学题)
geometry Accepts: 324 Submissions: 622 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 6553 ...
- 管道函数(pipelined function)简单使用示例
-----------------------------Cryking原创------------------------------ -----------------------转载请注明出处, ...
- NEFU 117 - 素数个数的位数 - [简单数学题]
题目链接:http://acm.nefu.edu.cn/JudgeOnline/problemShow.php?problem_id=117 Time Limit:1000ms Memory Limi ...
随机推荐
- C#.NET为List加入扩展方法:获取唯一值
public static class ListTools { /// <summary> /// 获取唯一值列表 /// </summary> /// <param n ...
- H5性能调优
概述 PC优化手段在Mobile侧同样适用 在Mobile侧我们提出三秒种渲染完成首屏指标 基于第二点,首屏加载3秒完成或使用Loading 基于联通3G网络平均338KB/s(2.71Mb/s),所 ...
- Angular 学习笔记——拖拽
<!DOCTYPE HTML> <html ng-app="myApp"> <head> <meta http-equiv="C ...
- kali渗透综合靶机(一)--Lazysysadmin靶机
kali渗透综合靶机(一)--Lazysysadmin靶机 Lazysysadmin靶机百度云下载链接:https://pan.baidu.com/s/1pTg38wf3oWQlKNUaT-s7qQ提 ...
- js - 正斜杆网址转换
2018-8-7(更新) let http = 'http://www.baidu.com/com/img/1.jpg'; let https = 'http:\\www.baidu.com\\com ...
- Fragment生命周期和Activity生命周期的关系
Fragment生命周期: 重点回调函数: 1. onAttach()当碎片和活动建立关联的时候调用.2. onCreateView()为碎片创建视图(加载布局)时调用.3. onActivityCr ...
- linux 命令笔记: iptables
配置虚拟机网卡 NAT 联网: iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -j MASQUERADE iptables -A FROWARD - ...
- smali语法高亮相关链接
http://ruby-china.org/topics/8307 http://www.daqianduan.com/4820.html http://www.cnblogs.com/ruochen ...
- ios侧滑返回:完美解决 interactivePopGestureRecognizer 卡住的问题
interactivePopGestureRecognizer是iOS7推出的解决VeiwController滑动后退的新功能,虽然很实用,但是坑也很多啊(比如在rootViewcontroller下 ...
- json对象和json字符串之间的转换-JavaScript实现
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...