Bode Plot

Time Limit: 1000MS   Memory Limit: 10000K
Total Submissions: 14060   Accepted: 8820

Description

Consider the AC circuit below. We will assume that the circuit is in steady-state. Thus, the voltage at nodes 1 and 2 are given by v1 = VS coswt and v2 = VRcos (wt + q ) where VS is the voltage of the source, w is the frequency (in radians per second), and t is time. VR is the magnitude of the voltage drop across the resistor, and q is its phase.

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

The
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

For each angular frequency in the input you are to output its corresponding VR on a single line. Each VR value output should be rounded to three digits after the decimal point.

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的更多相关文章

  1. 北大POJ题库使用指南

    原文地址:北大POJ题库使用指南 北大ACM题分类主流算法: 1.搜索 //回溯 2.DP(动态规划)//记忆化搜索 3.贪心 4.图论 //最短路径.最小生成树.网络流 5.数论 //组合数学(排列 ...

  2. POJ 1045

    #include<iostream> #include<cmath> #include<iomanip> using namespace std; int main ...

  3. POJ 1045:Bode Plot

    Bode Plot Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 13392   Accepted: 8462 Descri ...

  4. 【Java】深深跪了,OJ题目Java与C运行效率对比(附带清华北大OJ内存计算的对比)

    看了园友的评论之后,我也好奇清橙OJ是怎么计算内存占用的.重新测试的情况附在原文后边. -------------------------------------- 这是切割线 ----------- ...

  5. POJ 1861 Network (Kruskal算法+输出的最小生成树里最长的边==最后加入生成树的边权 *【模板】)

    Network Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 14021   Accepted: 5484   Specia ...

  6. 各大OJ

    北大POJ 杭电HDU 浙大ZOj 蓝桥杯 PAT

  7. leetcode学习笔记--开篇

    1 LeetCode是什么? LeetCode是一个在线的编程测试平台,国内也有类似的Online Judge平台.程序开发人员可以通过在线刷题,提高对于算法和数据结构的理解能力,夯实自己的编程基础. ...

  8. OJ题目JAVA与C运行效率对比

    [JAVA]深深跪了,OJ题目JAVA与C运行效率对比(附带清华北大OJ内存计算的对比) 看了园友的评论之后,我也好奇清橙OJ是怎么计算内存占用的.重新测试的情况附在原文后边. ----------- ...

  9. C++ 指针常见用法小结

    1. 概论 2.指针基础 3. 指针进阶 4. 一维数组的定义与初始化 5. 指针和数组 6. 指针运算 7. 多维数组和指针 8. 指针形参 9. 数组形参 10. 返回指针和数组 11. 结语   ...

  10. 几个比較好的IT站和开发库官网

    几个比較好的IT站和开发库官网 1.IT技术.项目类站点 (1)首推CodeProject,一个国外的IT站点,官网地址为:http://www.codeproject.com,这个站点为程序开发人员 ...

随机推荐

  1. loadrunner json

    Action(){ web_custom_request("JRPT_WriteLog", //VuGen中树形视图中显示的名称 "Url=url", //请求 ...

  2. Eclipse WTP Tomcat hot deploy

    转自: http://ducquoc.wordpress.com/2010/11/06/eclipse-wtp-tomcat-hot-deploy/ One of the reasons why Ja ...

  3. webp性能测评

    一.测评目的 通过分析webp图片在不同条件下的性能表现,来确定webp图片的适用场景. 二.测评方式 使用控制变量法,分别从以下3点对webp与jpg图片做对比,得出结论. 1.页面图片总体积. 2 ...

  4. 【转】Expire Google Drive Files 让Google Docs云盘共享连接在指定时间后自动失效

    最近在清理Google Docs中之前共享过的文件链接,发现Google Docs多人协作共享过的链接会一直存在,在实际操作中较不灵活.正好订阅的RSS推送了Pseric写的这篇文章 - Expire ...

  5. 学习笔记找到多个具有相同 ID“_header”的控件,FindControl 要求控件具有唯一的 ID.

    解决 找到多个具有相同 ID“_header”的控件,FindControl 要求控件具有唯一的 ID. private void DisplayHotBooks()    {        //获取 ...

  6. 通过图片对比带给你不一样的KMP算法体验

    KMP 算法,俗称“看毛片”算法,是字符串匹配中的很强大的一个算法,不过,对于初学者来说,要弄懂它确实不易. 笔者认为,KMP 算法之所以难懂,很大一部分原因是很多实现的方法在一些细节的差异.体现在几 ...

  7. 【转】【翻译】对响应式SVG的再思考

    来源: http://www.w3ctech.com/topic/1555 原文地址:http://www.smashingmagazine.com/2014/03/rethinking-respon ...

  8. PHP浮点数计算

    涉及到计算 和金额交易 使用bc系列函数 高精度计算 不会有0.57不精确的问题

  9. C#中REF和OUT的区别

    在C# 中,既可以通过值也可以通过引用传递参数.通过引用传递参数允许函数成员更改参数的值,并保持该更改.若要通过引用传递参数, 可使用ref或out关键字.ref和out这两个关键字都能够提供相似的功 ...

  10. WebApi系列~基于RESTful标准的Web Api

    微软的web api是在vs2012上的mvc4项目绑定发行的,它提出的web api是完全基于RESTful标准的,完全不同于之前的(同是SOAP协议的)wcf和webService,它是简单,代码 ...