POJ 1017
来源:互联网 发布:js 触发div事件 编辑:程序博客网 时间:2024/05/16 19:37
贪心
关键是求除数是
可以(x+n-1)/n来求
代码如下
#include<cstdio>#include<iostream>#include<algorithm>#include<cstring>using namespace std;int main(){int a,b,c,d,e,f;while(~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;int sum=0;sum+=e;sum+=f;a=max(0,a-11*e);sum+=d;if(b>=d*5){b-=d*5;}else{a=max(0,a-4*(d*5-b));b=0;}sum+=(c+3)/4;c%=4;if(c){if(b>=7-2*c){b-=7-2*c;a=max(0,a-(8-c));}else {a=max(0,a-(36-b*4-c*9));b=0;}}sum+=(b+8)/9;b%=9;if(b){a=max(0,a-(36-4*b));}sum+=(a+35)/36;printf("%d\n",sum); }return 0; }
阅读全文
0 0
- poj 1017
- POJ-1017
- POJ 1017
- POJ 1017
- poj 1017
- POJ 1017
- poj 1017
- POJ 1017
- poj 1017
- POJ 1017
- poj 1017
- POJ 1017
- poj 1017
- POJ 1017
- poj 1017
- POJ 1017
- 【POJ】 1017
- poj 1017
- 使用加速度传感器完成摇一摇功能
- 显示润乾报表提示Access denied for user 'root'@'localhost' (using password: YES)问题
- Hive:解决Hive创建文件数过多的问题
- Linux进程间通信——使用共享内存
- 日夜间模式切换第二种方式
- POJ 1017
- React Native 应用在键盘弹出时优雅地响应
- 欢迎使用CSDN-markdown编辑器
- Json 详解
- netty中自定义协议(加码器和解码器)
- Java基础之日期的调取
- golang配置https协议
- 不要暴力,也可以很容易地解题
- C# DATATABLE 重新排序