题目地址:

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. 调用android系统相机拍照并保存

    [java] view plaincopyprint? <span style="font-size:18px;">package com.demo; import j ...

  2. 高阶函数:map()/reduce()

    Python内建了map()和reduce()函数. 如果你读过Google的那篇大名鼎鼎的论文“MapReduce: Simplified Data Processing on Large Clus ...

  3. java 开发环境安装

    一.在mac上安装jdk 1. 下载Mac版本的JDK并安装      http://www.oracle.com/technetwork/java/javase/downloads/index.ht ...

  4. Spring学习三----------注入方式

    © 版权声明:本文为博主原创文章,转载请注明出处 Spring注入方式 本篇博客只讲最常用的两种注入方式:设值注入和构造器注入.代码为完整代码,复制即可使用. 1.目录结构 2.pom.xml < ...

  5. jquery中this和$(this)使用的地方

    插件中this代表$('元素')选择器 on()函数中this代表单个元素,$(this)代表单个选择器 反正有时代表整体,有时代表单个,代表单个时可以用$(this)来把他变成jquery对象

  6. condarc文件

    channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/ - https://mirrors.tuna.tsingh ...

  7. 串口设置-stty--设置终端线

    stty - chang and print terminal line settings SYNOPSIS stty [-F DEVICE | --file=DEVICE] [SETTING]... ...

  8. Microsoft-office 常见问题

    1.工作表写入保护,忘记密码,解决办法: 流程如下: 1打开文件2工具---宏----录制新宏---输入名字如:aa3停止录制(这样得到一个空宏)4工具---宏----宏,选aa,点编辑按钮5删除窗口 ...

  9. C# 托管

    委托 委托让我们可以把函数引用保存在变量中.这就像在 C++ 中使用 typedef 保存函数指针一样. 委托使用关键字 delegate 声明.看看这个例子,你就能理解什么是委托: 例子: 代码: ...

  10. IntelliJ IDEA生成 Serializable 序列化 UID 的快捷键

    首先创建一个类如Movie,让该类实现Serializable序列化接口. 然后我们需要依次按照以下的方法找到 Settings 之后我们需要以下几个操作,并找到 Serializable class ...