北大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,这个站点为程序开发人员 ...
随机推荐
- ireport5.6+jasperreport6.3开发(三)--以javabean为基准的报表开发(javabean)
这里只有ireport的开发没有web侧的程序. ireport的数据源可以说是多种多样,大致可以通过文件 数据库 bean类这三种方式,这里只介绍bean类 (数据库比较简单可参考其他的网站,文件没 ...
- thinkphp3.1.3中widget用法
今天搞了tp3.1的widget,继承了widget类,但是老是掉用错误,所以换种写法,直接继承action TestAction.class.php $this->display();//调用 ...
- Isometric terrain
Isometric terrainhttp://forum.mapeditor.org/t/isometric-terrain/192/2 无透视地图的地形制作时,将每一贴图逆时针旋转45度,则比较容 ...
- Sublime Text 2 代码片断
原文:Snippets 不管是在编码,还是写畅销书,你都可能会需要一遍又一遍的用到一些文本的小片断.使用片断来结束这种单调无聊的码字吧,片断是一种智能的模板,它能在合适的上下文中插入你需要的文本内容. ...
- ios基础篇(三十)—— AFNetworking的使用
一.AFNetworking的创建 1.新建工程,命名为AFNDemo 2.导入AFNetworking.h AFNetworking文件下载:https://github.com/AFNetwork ...
- blade and soul Personal Combos
Personal Combos Since Blade and Soul is mainly based on skills, the game is more interesting after y ...
- js 10秒倒计时 功能
请等待<span id=</span>秒 <script type="text/javascript"> function run(){ var s ...
- EF框架学习
简称EF,ADO.NET Entity Framework是微软以ADO.NET为基础所发展出来的对象关系对应(O/R Mapping)解决方案,是微软的一个ORM(面向对象的对象模型和关系型数据库的 ...
- java IO学习
1.如何将byte[]转换为String byte byt[] = new byte[1024]; int b = file.read(byt); //b是byt的实际读取到的长度 String st ...
- ASP.NET MVC 4 (三) 过滤器
先来看看一个例子演示过滤器有什么用: public class AdminController : Controller { // ... instance variables and constru ...