hdu2304Electrical Outlets
Roy likes to watch TV as he works on his computer, and to listen to his HiFi system (on high volume) while he vacuums, so using just the single outlet is not an option. Actually, he wants to have all his appliances connected to a powered outlet, all the time. The answer, of course, is power strips, and Roy has some old ones that he used in his old apartment. However, that apartment had many more wall outlets, so he is not sure whether his power strips will provide him with enough outlets now.
Your task is to help Roy compute how many appliances he can provide with electricity, given a set of power strips. Note that without any power strips, Roy can power one single appliance through the wall outlet. Also, remember that a power strip has to be powered itself to be of any use.
3 2 3 4
10 4 4 4 4 4 4 4 4 4 4
4 10 10 10 10
31
37
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath> using namespace std; int main()
{
int z,n,i,j,k;
cin>>z;
while(z--)
{
cin>>n;
int sum = ;
for(i = ;i<n;i++)
{
int a;
scanf("%d",&a);
sum+=a;
}
sum-=n-;
cout<<sum<<endl;
}
return ;
}
hdu2304Electrical Outlets的更多相关文章
- HDOJ(HDU) 2304 Electrical Outlets(求和、、)
Problem Description Roy has just moved into a new apartment. Well, actually the apartment itself is ...
- hdu 4463 Outlets(最小生成树)
Outlets Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submi ...
- HDU 4463 Outlets(最小生成树给坐标)
Problem Description In China, foreign brand commodities are often much more expensive than abroad. T ...
- Outlets 和Referencing Outlets的区别
转自:http://blog.sina.com.cn/s/blog_4431c7610100sypy.html 我的理解就是连接与被连接的关系吧 Outlets里面显示的是你的属性, 以及连接着的目标 ...
- zoj 2807 Electrical Outlets
Electrical Outlets Time Limit: 2 Seconds Memory Limit: 65536 KB Roy has just moved into a new a ...
- HDU—4463 Outlets 最小生成树
In China, foreign brand commodities are often much more expensive than abroad. The main reason is th ...
- POJ 2636:Electrical Outlets
Electrical Outlets Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9597 Accepted: 718 ...
- [Angular] Auxiliary named router outlets
Define a auxilliary router: export const ROUTES: Routes = [ { path: 'folder/:name', component: MailF ...
- Outlets
Outlets Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Sub ...
随机推荐
- iOS 关于tableView中有多个textField,输入框被遮住的解决方法
这里采用tableView整体上移的方法. 代码:(其中 60 为 单元格的高度) //点击输入框触发 - (void)textFieldDidBeginEditing:(UITextField *) ...
- POJ 2455 Secret Milking Machine (二分 + 最大流)
题目大意: 给出一张无向图,找出T条从1..N的路径,互不重复,求走过的所有边中的最大值最小是多少. 算法讨论: 首先最大值最小就提醒我们用二分,每次二分一个最大值,然后重新构图,把那些边权符合要求的 ...
- (转)ubuntu下如何查看软件安装目录以及安装版本
1.查询版本 aptitude show 软件名 例如:aptitude show kde-runtime 显示如下: ****@ubuntu:~$ aptitude show kde-runtime ...
- C++程序设计实践指导1.1删除序列中相同的数改写要求实现
改写要求1:改写为以指针为数据结构 #include <iostream> #include <cstdlib> using namespace std; class ARP ...
- 2015.4.2-SQL 简单语句(一)
1.创建一个student表 create table student_masen( sno char(4) not null primarykey sname nchar(10) not null ...
- 详解一名合格PHP工程师应该具备的基本知识结构
在学习php时的一些小沉淀,供童鞋们欣赏哈.. 1.掌握语言本身的语法,熟悉常用类库是必须的: 2.面向对象最为当今的主流也是必须掌握的: 3.常用设计模式必须掌握,设计模式是前辈的总结.经验: 4. ...
- 字符串分割与数组的分割 split()VSsplice()&slice()
一.作用对象 1.split()方法是对字符串的操作:splice()和slice()是对数组的操作.slice()也可用于字符串. 二.参数 1.split(separator,howmany) 参 ...
- web项目配置webAppRootKey 获得根目录 .
log4j和web.xml配置webAppRootKey 的问题 1 在web.xml配置 <context-param> <param-name>webAppRootKey ...
- 十进制二进制之间的转化 PHP算法
[ 十进制转二进制 ] function test($var){ $func = function($i){ if($i < 2){ return $i; } $return['int'] = ...
- Database Go and JSON
在使用Go开发web项目的过程中, 数据库读写操作与JSON格式的输入输出是两块最基础的模块, Go的标准库已经帮我们做了很多, 熟悉database/sql与encoding/json这两个库能帮我 ...