[poj解题]1017
| Time Limit: 1000MS | Memory Limit: 10000K | |
| Total Submissions: 41014 | Accepted: 13776 |
Description
Input
Output
Sample Input
0 0 4 0 0 1
7 5 1 0 0 0
0 0 0 0 0 0
Sample Output
2
1
#include <stdio.h>
#include <string.h> int main(){
int a,b,c,d,e,f;
int al, bl;
int total;
int tmp; a = b = c = d = e = f = 0; while(1){
total = 0;
tmp = 0;
al = bl = 0;
scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f); if(a == 0&& b == 0 && c == 0&& d == 0 && e == 0 && f ==0){
break;
} /*
6*6
*/
total += f;
/*
5*5
*/
if(e>0){
total += e;
al += 11 * e;
} /*
4*4
*/
if(d>0){
total += d;
bl += 5 * d;
} /*
3*3
*/
if(c > 0){
tmp = (c%4 == 0)? 0:1;
total += (c/4 + tmp);
tmp = c%4;
if(tmp == 1){
al += 7;
bl += 5;
}
else if(tmp == 2){
al += 6;
bl += 3;
}
else if(tmp == 3){
al += 5;
bl += 1;
}
} /*
2 * 2
*/
if(b > 0){
if(b<=bl) {
al += 4 * (bl - b);
bl = 0;
b = 0;
}
else{
b -= bl;
bl = 0;
}
} if(b > 0){
tmp = (b%9 == 0)? 0:1;
total += (b/9 + tmp);
if(b%9 !=0){
al += 36 - 4*(b %9);
}
b = 0;
} al += bl * 4; if(a > 0){
if(a<=al){
a = 0;
}
else{
a = a - al;
}
} tmp = (a%36 == 0)? 0:1;
total += (a/36 + tmp);
printf("%d\n", total);
} return 0;
}
[poj解题]1017的更多相关文章
- POJ解题经验交流
感谢范意凯.陈申奥.庞可.杭业晟.王飞飏.周俊豪.沈逸轩等同学的收集整理. 题号:1003 Hangover求1/2+1/3+...1/n的和,问需多少项的和能超过给定的值 类似于Zerojudg ...
- 【poj解题】1028
stack的应用 #include<iostream> #include<stack> #include<stdio.h> #include<stdlib.h ...
- 【poj解题】3664
简单,两次排序 #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 500 ...
- 【poj解题】3663
排序, 遍历,需要裁减 #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX ...
- 【poj解题】1308
判断一个图是否是一个树,树满足一下2个条件即可:1. 边树比node数少12. 所有node的入度非0即1 节点数是0的时候,空树,合法树~ 代码如下 #include <stdio.h> ...
- 洛谷 P1731 [NOI1999]生日蛋糕 && POJ 1190 生日蛋糕
题目传送门(洛谷) OR 题目传送门(POJ) 解题思路: 一道搜索题,暴力思路比较容易想出来,但是这道题不剪枝肯定会TLE.所以这道题难点在于如何剪枝. 1.如果当前状态答案已经比我们以前某个状态 ...
- POJ 1017
http://poj.org/problem?id=1017 题意就是有6种规格的物品,给你一些不同规格的物品,要求你装在盒子里,盒子是固定尺寸的也就是6*6,而物品有1*1,2*2,3*3,4*4, ...
- POJ 1003 解题报告
1.问题描述: http://poj.org/problem?id=1003 2.解题思路: 最直观的的想法是看能不能够直接求出一个通项式,然后直接算就好了, 但是这样好水的样子,而且也不知道这个通项 ...
- POJ 1004 解题报告
1.题目描述: http://poj.org/problem?id=1004 2.解题过程 这个题目咋一看很简单,虽然最终要解出来的确也不难,但是还是稍微有些小把戏在里面,其中最大的把戏就是float ...
随机推荐
- PHP:var_dump展示不全
问题:var_dump展示不全,出现省略号 我们使用php的var_dump函数,可以更直观的查看输出结果,包括类型,数量等详细信息.此函数显示关于一个或多个表达式的结构信息,包括表达式的类型与值.数 ...
- android,view的执行过程onDraw、onSizeChanged,onFinishInflate
小试view的执行过程,此是入门,高手绕道. ----------------------------------------------------------------------------- ...
- linux下编译安装apache
在linux(CentOS6.5)上安装Apache,要首先确保以下程序事先安装 apr:The mission of the Apache Portable Runtime (APR) projec ...
- [Java]知乎下巴第0集:让我们一起来做一个知乎爬虫吧哦耶【转】
文章来源:http://jp.51studyit.com/article/details/16203.htm 作者: 汪海洋 身边的小伙伴们很多都喜欢刷知乎,当然我也不例外, 但是手机刷太消耗流量, ...
- 为PO手写添加配置文件(hbm.xml)
- kafuka常用的shell命令
kafka常用shell命令: ------------------------------------ 1.创建topic bin/kafka-topics.sh --create --zookee ...
- socket小解
要理解socket,首先得理解TCP/IP协议族, TCP/IP (Transmission Control Protocol/Internet Protocol)传输控制协议/网间协议 定义: TC ...
- Lua 基础 -- 学习笔记
标签(空格分隔): Lua 1. Lua可以一次性给多个变量赋值 变量比赋值多,多的变量就赋值nil 变量比赋值少,多的赋值舍弃 local a, b, c = 1, 2, 3 print( a, b ...
- json对象的简单介绍
1.JSON(JavaScript Object Notation)一种简单的数据格式,比xml更轻巧.JSON是JavaScript原生格式,这意味着在JavaScript中处理JSON数据不需要任 ...
- CodeForces--TechnoCup--2016.10.15--ProblemB--Bill Total Value(字符串处理)
Bill Total Value time limit per test 1 second memory limit per test 256 megabytes input standard inp ...