Codeforces 388A - Fox and Box Accumulation】的更多相关文章

388A - Fox and Box Accumulation 思路: 从小到大贪心模拟. 代码: #include<bits/stdc++.h> using namespace std; const int INF=0x3f3f3f3f; ; int a[N]; bool vis[N]={false}; int main() { ios::sync_with_stdio(false); cin.tie(); int n; ; cin>>n; ;i<n;i++) { cin&…
A. Fox and Box Accumulation time limit per test:1 second memory limit per test:256 megabytes Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its t…
题目链接:http://codeforces.com/problemset/problem/388/A 题目意思:有 n 个 boxes,每个box 有相同的 size 和 weight,但是strength 有可能不同.strength的数值表示该box的上面只能放strength 个 boxes,直到放不下,这样就成了一个pile. 问如何叠放使得pile 的个数最少. 一开始从最底层放置考虑,于是越想越复杂..... 可以从最高层来开始,那么放在最上面的box的strength最小可以为0…
一开始贪心策略想错了! #include<cstdio> #include<algorithm> using namespace std; ]; int main() { int n; scanf("%d",&n); ; i<n; i++) { scanf("%d",&s[i]); } sort(s,s+n); int ans; bool flag; ;k<=n;k++) { flag=; ;i<n;i++)…
A. Fox and Box Accumulation 题目连接: http://codeforces.com/contest/388/problem/A Description Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top…
C. Fox and Box Accumulation time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The…
题目:http://codeforces.com/contest/389/problem/C 题意:给n个箱子,给n个箱子所能承受的重量,每个箱子的重量为1: 很简单的贪心,比赛的时候没想出来...... 先从小到大排一下序,然后从最上层向下找,只要能承受住重量就行.而且因为已经排序了找的都是尽量小的... #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib>…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most x…
题意:输入一个n,然后输入n个数,问你可以划分多少个序列,序列为:其中一个数为c,在它的前面最多可以有c个数. 思路:先排序,然后对于每一个数逐步的找没有被用过的数,且这个数可以符合条件,然后如果没有找到,结果加1:最后就是答案. #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int n; ]; ]; ][]; ]; int main() { while(sc…
[codeforces 241]C. Mirror Box 试题描述 Mirror Box is a name of a popular game in the Iranian National Amusement Park (INAP). There is a wooden box, 105 cm long and 100cm high in this game. Some parts of the box's ceiling and floor are covered by mirrors.…