题目地址:

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

  1. [acm]HDOJ 2059 龟兔赛跑

    题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2059 起点和终点,共n+2个点,n+2个状态,简单DP即可. //11512698 2014-08- ...

  2. [acm]HDOJ 2673 shǎ崽 OrOrOrOrz

    题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2673 拍两次序,交替输出 #include<iostream> #include< ...

  3. [acm]HDOJ 1200 To and Fro

    题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=1200 简单字符串处理,找规律 /* 11509672 2014-08-21 11:32:55 Acc ...

  4. [acm]HDOJ 2064 汉诺塔III

    题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2064 汉诺塔变种,只能从中间专业,递归关系为:f(n)=3*f(n-1)+2. //汉诺塔变种,只能 ...

  5. 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 ...

  6. HDOJ acm steps 3.1.1

    (都是递推求值,呵呵,好开心- - ) 今天又是在自习室通宵(文明玩的停不下来了) 游戏玩完想想该水题了,于是打开了HDOJ的ACM STEPS(这是个好东西,就像他的名字,一步步来的) 2.3.x貌 ...

  7. 【HDOJ】5096 ACM Rank

    Treap+set仿函数重定义.每当ac一道题目时,相当于对总时间减去一个大数. /* 5096 */ #include <iostream> #include <string> ...

  8. excel acm 高校排名(hdoj)

    其实写一个程序是最方便的... 不用每次进行很多次操作. 当然,能获得后台的数据更好…… e.g. 链接: https://pan.baidu.com/s/1a7s85oaKGam1-0mJ2v39u ...

  9. HDOJ 3547 DIY Cube 解题报告

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3547 题目大意:求用$C$种颜色给立方体的8个顶点染色的本质不同的方法.两种方法本质不同即不能通过旋转 ...

随机推荐

  1. HPE IT 的DevOps 实践分享

    原文地址:http://www.codes51.com/article/detail_3124576.html 本篇文章来自于HPE和msup共同举办的技术开放日HPE测试技术总监肖俊的分享,由壹佰案 ...

  2. python中@property的使用

    在绑定属性时,如果我们将属性直接暴露在外面,就可能导致属性被任意修改,有时候这个是我们不希望看到的如:设置学生的成绩 class Student(object): def __init__(self) ...

  3. npm常用命令(转)

    npm install <name>安装nodejs的依赖包 例如npm install express 就会默认安装express的最新版本,也可以通过在后面加版本号的方式安装指定版本, ...

  4. rtems 4.11 RTC驱动 (arm, beagle)

    RTC驱动的框架在 c/src/lib/libbsp/shared/tod.c 中,大部分功能都已经实现了,入口函数是 rtc_initialize(),BSP要实现的东西非常少. beagle的实现 ...

  5. K均值算法总结

    这几天在一个项目上需要用到K均值聚类算法,以前都是直接利用百度老师copy一个Kmeans算法代码,这次想自己利用已知的算法思想编写一下,编写才知道,虽然熟悉了算法思想,真正实现时,还是遇到不少bug ...

  6. 【PyCharm编辑器】之引用selenium包提示错误:Unresolved reference 'selenium' less... (Ctrl+F1)

    一.现象还原: 当新建.py文件时,需要引用selenium中的方法时,报错,提示红波浪线: Unresolved reference 'selenium' less... (Ctrl+F1) Thi ...

  7. 模式匹配之surf----特征点检测学习_2(surf算法)

    在上篇博客特征点检测学习_1(sift算法) 中简单介绍了经典的sift算法,sift算法比较稳定,检测到的特征点也比较多,其最大的确定是计算复杂度较高.后面有不少学者对其进行了改进,其中比较出名的就 ...

  8. EasyPlayerPro(Windows)流媒体播放器开发之ffmpeg log输出报错

    EasyPlayerPro主要基于ffmpeg进行开发,在EasyPlayerPro开发过程中,曾遇到一个相对比较棘手的问题,该问题一般在播放不是很标准的流或者网络情况较差,容易出现丢帧的情况特别容易 ...

  9. 九度OJ 1041:Simple Sorting(简单排序) (排序)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:4502 解决:1680 题目描述: You are given an unsorted array of integer numbers. ...

  10. bmdiff snappy lzw gzip

    https://github.com/google/snappy Introduction [速度第一,压缩比适宜] [favors speed over compression ratio] Sna ...