[acm]HDOJ 3082 Simplify The Circuit
题目地址:
http://acm.hdu.edu.cn/showproblem.php?pid=3082
字符串处理+并联电阻公式
//11481261 2014-08-18 16:52:47 Accepted 3082 0MS 384K 733 B G++ 空信高手
#include<string>
#include<iostream>
#include<cstdio>
#include<cstdlib> using namespace std; int main()
{
//freopen("input.txt","r",stdin);
string str;
int Sum=,nCases=,count=;
cin>>count;
double circuit=;
while(count--)
{
cin>>nCases;
circuit=;
while(nCases--)
{
cin>>str;
Sum=;
int end = ;
int pre = ;
while(end<str.length())
{
if(str[end]=='-')
end++;
else
{
pre=end;
while((str[end]!='-')&&(end<str.length()))
{
end++;
}
//字符串分割
string str1 = str.substr(pre,end-pre);
int i = atoi(str1.c_str());
Sum+=i;
}
}
circuit+=1.0/Sum; //并联电阻公式
}
printf("%.2lf\n",1.0/circuit);
} return ;
}
[acm]HDOJ 3082 Simplify The Circuit的更多相关文章
- [acm]HDOJ 2059 龟兔赛跑
题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2059 起点和终点,共n+2个点,n+2个状态,简单DP即可. //11512698 2014-08- ...
- [acm]HDOJ 2673 shǎ崽 OrOrOrOrz
题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2673 拍两次序,交替输出 #include<iostream> #include< ...
- [acm]HDOJ 1200 To and Fro
题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=1200 简单字符串处理,找规律 /* 11509672 2014-08-21 11:32:55 Acc ...
- [acm]HDOJ 2064 汉诺塔III
题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2064 汉诺塔变种,只能从中间专业,递归关系为:f(n)=3*f(n-1)+2. //汉诺塔变种,只能 ...
- Simple dc/dc converter increases available power in dual-voltage system
The schematic in Figure 1 shows a way to increase the power available from a current-limited 5V supp ...
- HDOJ acm steps 3.1.1
(都是递推求值,呵呵,好开心- - ) 今天又是在自习室通宵(文明玩的停不下来了) 游戏玩完想想该水题了,于是打开了HDOJ的ACM STEPS(这是个好东西,就像他的名字,一步步来的) 2.3.x貌 ...
- 【HDOJ】5096 ACM Rank
Treap+set仿函数重定义.每当ac一道题目时,相当于对总时间减去一个大数. /* 5096 */ #include <iostream> #include <string> ...
- excel acm 高校排名(hdoj)
其实写一个程序是最方便的... 不用每次进行很多次操作. 当然,能获得后台的数据更好…… e.g. 链接: https://pan.baidu.com/s/1a7s85oaKGam1-0mJ2v39u ...
- HDOJ 3547 DIY Cube 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3547 题目大意:求用$C$种颜色给立方体的8个顶点染色的本质不同的方法.两种方法本质不同即不能通过旋转 ...
随机推荐
- Qt on Android:将Qt调试信息输出到logcat中
版权全部 foruok .如需转载敬请注明出处(http://blog.csdn.net/foruok). 假设你在目标 Android 设备上执行了 Qt on Android 应用,你可能希望看到 ...
- linux init->upstart->systemd
http://en.wikipedia.org/wiki/Init init From Wikipedia, the free encyclopedia This article is abo ...
- 【强网杯2018】Gamebox
参考: https://www.cnblogs.com/hac425/p/9416787.html http://tacxingxing.com/2018/03/28/2018qwb/ 事后复盘pwn ...
- ubuntu boost.python
安装boost(未尝试只安装 libboost-python-dev) sudo apt-get install libboost-all-dev 新建hello_ext.cpp,输入以下代码 1 c ...
- Makefile调用shell应该注意的地方
转载:http://blog.csdn.net/ninlei0115/article/details/9732191 1.在Makefile中只能在target中调用Shell脚本,其他地方是不能输出 ...
- python os模块 常用函数
os.getcwd() 获取当前工作目录 os.listdir() 返回指定目录下的所有文件和目录 os.remove() 删除单个文件 os.path.split() 以元祖形式返回一个路径的目录和 ...
- js document.queryCommandState() 各个参数
命令标识符 2D-Position 允许通过拖曳移动绝对定位的对象. AbsolutePosition 设定元素的 position 属性为“absolute”(绝对). BackColor 设置或获 ...
- 【bootstrap】右侧sidebar不跟着内容滚动的异常
移动开发需要依赖于Web服务的接口,但是写这个接口文档实在是比较繁琐,所以今天我就写了个包解析程序自动生成接口文档. 内容显示我是借鉴Bootstrap的官方教程http://v3.bootcss.c ...
- ASP.NET动态网站制作(13)-- JQ(5)
前言:jq的最后一节课,主要讲解应用, 内容: 1.会飞的li: HTML代码: <!DOCTYPE html> <html xmlns="http://www.w3.or ...
- Swift———a Glance(极客学院)笔记
http://www.swiftv.cn/course/hw4sysi7 本课程很短,加起来一个小时,适合作为一个快速了解. 两本书: apple官方<The Swift Programmi ...