题目地址:

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. centos6.6安装mysql5.5

    在mysql官网下载mysql-5.5.54-linux2.6-x86_64.tar.gz解压:tar -zxvf  mysql-5.5.54-linux2.6-x86_64.tar.gz修改名字mv ...

  2. 解决phpmyadmin导入大数据库出现一系列问题

    在用phpmyadmin导入mysql数据库文件时,往往超过2M就会提示文件大,导入不成功.这时我们打开phpmyadmin-->libraries-->config.default.ph ...

  3. linux下性能监控工具

    一.  Linux 性能监控的概述 系统由若干子系统构成,通常改动一个子系统有可能影响到另外一个子系统.甚至会导致整个系统不稳定.崩溃. 所以说优化.监測.測试一般是连在一起的,并且是一个循环并且长期 ...

  4. Failed to fetch URL https://dl-ssl.google.com/android/repository/addons_list-2.xml, reason: Connect

    Failed to fetch URL https://dl-ssl.google.com/android/repository/addons_list-2.xml, reason: Connect ...

  5. SQL注入基础入门

    一般的WEB架构 SQL注入成因: 用户开启浏览器并连接http://www.xxx.com.位于逻辑层的Web服务器从文件系统中加载脚本将其传递给脚本引擎,脚本引擎负责解析并执行脚本. 脚本使用数据 ...

  6. js中比較好的继承方式

    前面说到了原型和原型链,今天就来说说在面向对象中比較好的继承方式吧.先来看看两种基础的继承方式: 一.构造函数型 function People(name) { this.name=name; } P ...

  7. 现在有一张半径为r的圆桌,其中心位于(x,y),现在他想把圆桌的中心移到(x1,y1)。每次移动一步,都必须在圆桌边缘固定一个点然后将圆桌绕这个点旋转。问最少需要移动几步。

    // ConsoleApplication5.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include<vector> ...

  8. C#定时检測子线程是否已经完毕

    C#定时检測子线程是否已经完毕 class Program { static void Main(string[] args) { //主线程中启动一个支线程,运行doSomething这种一个方法. ...

  9. php部分--题目:投票 重点:两个div套用,显示百分比;

    1.建立两个表格:要显示百分比的话,就要在选项表中加上一列标记number 2.链接数据库,并对题目和选项进行显示 <?php $db=new MySQLi("localhost&qu ...

  10. EasyPlayer Android安卓RTSP服务器低延时再优化策略

    EasyPlayer低延迟再优化策略 EasyPlayer是一款专门针对RTSP协议进行过优化的播放器.其中两个我们引以为傲的的优点就是起播快和低延迟.最近我们遇到一些需求,其对延迟要求非常苛刻,于是 ...