Codeforces Round #228 (Div. 1) A】的更多相关文章

题目:http://codeforces.com/contest/389/problem/C 题意:给n个箱子,给n个箱子所能承受的重量,每个箱子的重量为1: 很简单的贪心,比赛的时候没想出来...... 先从小到大排一下序,然后从最上层向下找,只要能承受住重量就行.而且因为已经排序了找的都是尽量小的... #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib>…
今天学长给我们挂了一套Div.1的题,难受,好难啊. Problem A: 题目大意:给你n个数字,让你叠成n堆,每个数字上面的数的个数不能超过这个数,如 3 上面最多放三个数字 问你,最少能放几堆. 刚开始看错题意,以为只要比这个数字小的数都能放上去,后来看清了题意,一直想的是怎么从下往上放,感觉 二分加贪心可以做,但是太麻烦了,后来想如果从上往下放就好做多了,每次从小的开取,这样到取下一个数的 时候就知道上面有多少,能不能取这个数,这样的话也能保证这一堆是最优的. #include<bits…
C. Fox and Card Game 题目连接: http://codeforces.com/contest/388/problem/C Description Fox Ciel is playing a card game with her friend Fox Jiro. There are n piles of cards on the table. And there is a positive integer on each card. The players take turns…
B. Fox and Minimal path 题目连接: http://codeforces.com/contest/388/problem/B Description Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You…
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…
链接:http://codeforces.com/problemset/problem/388/B [题意] 给出一个整数K,构造出刚好含有K条从1到2的最短路的图. [分析] 由于是要自己构造图,当然构造的方法很多了,需要考虑简单性和可行性.出于简单考虑,图中从1到2的所有路径都是最短路,为了保证路径长度一样,在构图时就需要分层次,使得每一层的点距离上一层的点的距离都是一个单位. 那么如何使得路径条数刚好为K呢,这里涉及到相邻层次的点的链接方式.比如说每个点和上一层的所有点都有链接,那么这样总…
做codeforces以来题目最水的一次 A题: Fox and Number Game 题意:就是用一堆数字来回减,直到减到最小值为止,再把所有最小值加,求这个值 sol: 简单数论题目,直接求所有数字的最大公约数即可 ps: 以前cf出过这道题目啊,出题人没救了 5分钟300人过  ; ? a : gcd(b,a%b);  }   {           )      {          ;i<n;i++) scanf(         ];          ;i<n;i++)    …
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int main(){ int n; cin >> n; vector<string> board(n); ; ; i < n; ++ i ){ cin >> board[i]; } ; i < n-; i ++ ){…
#include <iostream> #include <algorithm> #include <vector> #include <numeric> using namespace std; int main(){ int n; cin >> n; vector<); ; i < n; ++ i ){ cin >> x[i]; } bool flag = true; while(flag){ flag = false…
B. Fox and Minimal path time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with …