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. 3个sprint的团队贡献分

    第一次冲刺贡献分   成员名字 贡献分 101丘娟 23 108周诗琦 26 107杨晓霞 24 124陈程 27     第二次冲刺贡献分   成员名字 贡献分 101丘娟 23 108周诗琦 27 ...

  2. 并列统计CASE WHEN

    select sum(case when depart = 'Physical' then 1 else 0 end) PhyTotal, sum(case when depart = 'Chemis ...

  3. javaWeb中 servlet 、request 、response

    1.Servlet (1)Servlet是JavaEE的一个动态web资源开发技 术,就是在服务器上运行的小程序,这个小程序是由服务器调用的,服务器为了能调用这个小程序,就要求这样的程序必须实现一个S ...

  4. ZACC_DOCUMENT

    method if_ex_acc_document~change. data: wa_extension type bapiparex, ext_value() type c, wa_accit ty ...

  5. Apache多端口监听

    打开:config/httpd.conf 找到Listen 80 在下面增加你要监听的端口,修改后如下: Listen 80 Listen 81 重启apache服务器

  6. Hammer.js

    一.前言 移动端框架当前还处在初级阶段,但相对于移动端的应用来说已经有很长时间了.虽然暂时还没有PC端开发的需求量大,但移动端的Web必然是一种趋势,在接触移动端脚本的过程中,最开始想到的是juqer ...

  7. 无废话SharePoint入门教程五[创建SharePoint页面布局]

    一.前言 文章成体系,如果有不明白的地方请查看前面的文章. 二.目录 1.创建页面布局 2.首次使用页面布局 3.修改页面布局 4.使用页面布局 5.最终效果 1.创建页面布局 (1)打开设计管理器, ...

  8. 杭电--1102--Constructing Roads--并查集

    Constructing Roads Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Other ...

  9. 《AngularJS权威教程》中关于指令双向数据绑定的理解

    在<AngularJS权威教程>中,自定义指令和DOM双向数据绑定有一个在线demo,网址:http://jsbin.com/IteNita/1/edit?html,js,output,具 ...

  10. Git-rebase 小笔记

    转自: https://blog.yorkxin.org/posts/2011/07/29/git-rebase/ 最近刚好有个机会整理很乱的Git commit tree,终于搞懂了rebase 的 ...