北大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,这个站点为程序开发人员 ...
随机推荐
- SSH网上答题系统质量属性
我要做的事网上答题系统,通过注册登录到答题页面. 这其中数据库的连接靠Hibernate,数据库的增删改查用Sruts2实现. 关于Struts2的学习,仅仅在action的表面上,可以在action ...
- Asp.net有关访问页面权限的限制和错误页面配置
一.访问页面权限的限制 一个小项目,涉及到用户登录. 在用户没登录访问内容也时,对页面做一定限制,没登录的则不能访问,直接跳转到登录界面. /// <summary> /// 对没有登录用 ...
- n进制转化成十进制
一个字节是8位二进制. 我的天啊.我发现char特别厉害: char类型能够输入整形常量.不能超过-128~127. 只能是整数类型,且范围一般不能超出-128~127.超出会溢出的.
- 【教程】16岁黑客如何把Windows 95装进智能手表?【转】
来自美国佐治亚州的16岁黑客Corbin Davenport十分喜欢摆弄电子产品,最近他刚到手了一台三星Gear Live,并开始把玩起来.他发现Android Wear作为Android系统的改版并 ...
- js实现图片的大小自适应效果
需求是传过来一个图片,根据外层div的大小自动进行缩放效果. function ShowSecondImg(v) { var rate, newX, newY,newW, newH = 0; //表示 ...
- mongodb的一些小总结
mongodb的安装,官网下载想要的版本,可视化工具mongovue(注意不支持mongodb3.0以上的版本) 下载mis安装,解压后bin,... 1.配置环境变量,将H:\mongodb\mon ...
- web工程关于500错误
昨天一直被一个诡异问题困扰,解决了之后开心得的我连玩了一下午,哈哈哈哈哈哈哈哈-- 具体问题是这样的额,本地跑的贼正常,一发到测试服务器就报500错误,具体错误信息是. HTTP Status 50 ...
- occ代码分析
临时变量就是local里面的变量擦除变量就是把模型改成擦除标记 void SelectMgr_SelectionManager::LoadMode (const Handle(SelectMgr_Se ...
- DataTable Linq Example
DataTable CreateTable() { DataTable dtable = new DataTable(); DataColumn dc; //MId CId FId PId dc = ...
- Joomla软件功能介绍与开源程序大比拼Joomla,wordpress,Drupal哪个好?
Joomla 软件功能介绍: Joomla!是一套在国外相当知名的内容管理系统 (Content Management System, CMS),它属于Portal(企业入口网站)类型,顾名思义 ...