北大poj- 1045
Bode Plot
Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 14060 | Accepted: 8820 |
Description
You are to write a program to determine VR for different values of w. You will need two laws of electricity to solve this problem. The first is Ohm's Law, which states v2 = iR where i is the current in the circuit, oriented clockwise. The second is i = C d/dt (v1-v2) which relates the current to the voltage on either side of the capacitor. "d/dt"indicates the derivative with respect to t.
Input
input will consist of one or more lines. The first line contains three
real numbers and a non-negative integer. The real numbers are VS,
R, and C, in that order. The integer, n, is the number of test cases.
The following n lines of the input will have one real number per line.
Each of these numbers is the angular frequency, w.
Output
Sample Input
1.0 1.0 1.0 9
0.01
0.031623
0.1
0.31623
1.0
3.1623
10.0
31.623
100.0
Sample Output
0.010
0.032
0.100
0.302
0.707
0.953
0.995
1.000
1.000
Source
/*
1.0 1.0 1.0 9
0.01
0.031623
0.1
0.31623
1.0
3.1623
10.0
31.623
100.0
*/ #include <stdio.h>
#include <math.h> #define MAX_NUM 50 int n;
double Vs, R, C;
double w[MAX_NUM], Vr[MAX_NUM]; void GetData()
{
int i = ;
scanf("%lf %lf %lf %d", &Vs, &R, &C, &n);
for(i=; i<n; i++)
{
scanf("%lf", &w[i]);
}
} void Calc()
{
int i = ;
for(i=; i<n; i++)
{
Vr[i]=C*R*w[i]*Vs / sqrt( + pow(C*R*w[i], ));
}
} void PrintResult()
{
int i = ;
for(i=; i<n; i++)
{
printf("%.3f\n", Vr[i]);
}
} int main()
{
GetData();
Calc();
PrintResult();
return ;
}
北大poj- 1045的更多相关文章
- 北大POJ题库使用指南
原文地址:北大POJ题库使用指南 北大ACM题分类主流算法: 1.搜索 //回溯 2.DP(动态规划)//记忆化搜索 3.贪心 4.图论 //最短路径.最小生成树.网络流 5.数论 //组合数学(排列 ...
- POJ 1045
#include<iostream> #include<cmath> #include<iomanip> using namespace std; int main ...
- POJ 1045:Bode Plot
Bode Plot Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13392 Accepted: 8462 Descri ...
- 【Java】深深跪了,OJ题目Java与C运行效率对比(附带清华北大OJ内存计算的对比)
看了园友的评论之后,我也好奇清橙OJ是怎么计算内存占用的.重新测试的情况附在原文后边. -------------------------------------- 这是切割线 ----------- ...
- POJ 1861 Network (Kruskal算法+输出的最小生成树里最长的边==最后加入生成树的边权 *【模板】)
Network Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 14021 Accepted: 5484 Specia ...
- 各大OJ
北大POJ 杭电HDU 浙大ZOj 蓝桥杯 PAT
- leetcode学习笔记--开篇
1 LeetCode是什么? LeetCode是一个在线的编程测试平台,国内也有类似的Online Judge平台.程序开发人员可以通过在线刷题,提高对于算法和数据结构的理解能力,夯实自己的编程基础. ...
- OJ题目JAVA与C运行效率对比
[JAVA]深深跪了,OJ题目JAVA与C运行效率对比(附带清华北大OJ内存计算的对比) 看了园友的评论之后,我也好奇清橙OJ是怎么计算内存占用的.重新测试的情况附在原文后边. ----------- ...
- C++ 指针常见用法小结
1. 概论 2.指针基础 3. 指针进阶 4. 一维数组的定义与初始化 5. 指针和数组 6. 指针运算 7. 多维数组和指针 8. 指针形参 9. 数组形参 10. 返回指针和数组 11. 结语 ...
- 几个比較好的IT站和开发库官网
几个比較好的IT站和开发库官网 1.IT技术.项目类站点 (1)首推CodeProject,一个国外的IT站点,官网地址为:http://www.codeproject.com,这个站点为程序开发人员 ...
随机推荐
- 数字图像处理作业使用OpenCV - 块提取
今天要记录的是树图第二次作业的第二题,Image Patch Extraction.这个概念真的不难懂,但是如果要我实际写的话,还真的不知道要怎么去遍历图像矩阵来提取块.在此要多谢邓大神的热心帮助,告 ...
- java selenium针对多种情况的多窗口切换
一.通过按钮点击打开的新页面,不涉及到打开多窗口,只要在已有打开的窗口实现切换操作即可 Set<String> winHandels = driver.getWindowHandles() ...
- onthink 数据库连接配置
define('UC_DB_DSN', 'mysql://root:@127.0.0.1:3306/app'); // 数据库连接,使用Model方式调用API必须配置此项 /* 数据库配置 */ ' ...
- easyui datagrid 分页
//初始化dategrid $('#tt').datagrid({ url:null, pagination:true, pageSize:, pageNumber:, rownumbers:true ...
- thinkPHP的用法之创建新项目
1 配置文件中 新增数组元素:'DEFAULT_APPS'=> array('api', 'admin', 'home', 'megagame'), 2 新增样式变量 在view.class.p ...
- hdu 5927 Auxiliary Set
传送门 分析:感觉这道题有点意思.就写一篇mark一下吧. 现场比赛的时候去枚举了儿子用了线段树+dfs序,和预想的一样T了. 可以换一个想法,从儿子对父亲的贡献来思考. 在点中先假设一个节点的每一个 ...
- occ 中绘制二维矩形
在屏幕上绘制一个二级矩形 #include <Visual3d_Layer.hxx> #include <V3d_LayerMgr.hxx> #include <Visu ...
- AngularJS学习笔记
一.初识AngularJS:1.Angularjs通过创建实时模板来代替视图,而不是将数据合并进模板后更新DOM,任何一个独立视图组件中的值都是动态替换的. 二.数据绑定和第一个AngularJS W ...
- HTML标签-【fieldset】-fieldset
<fieldset style="width: 400px; height: auto; margin: 10px auto"> <legend>用户基本信 ...
- RPN-逆波兰计算器-中缀表达式转后缀表达式-javascript
1.利用栈(Stack)来存储操作数和操作符: 2.包含中缀表达式转后缀表达式的函数,这个是难点,也是关键点: 2.1.将输入字符串转为数组: 2.2.对转换来的字符进行遍历:创建一个数组,用来给存储 ...