158B - Taxi
2015-05-21 15:41
309 查看
#include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <string> #include <algorithm> using namespace std; int cnt[5]; int main() { memset(cnt, 0, sizeof(cnt)); int n, x; int ans = 0; scanf("%d", &n); for(int i = 0; i < n; ++i) { scanf("%d", &x); cnt[x]++; } ans += cnt[4]; ans += cnt[3]; cnt[1] -= min(cnt[1], cnt[3]); ans += cnt[2]/2; int t = (cnt[2]%2)*2 + cnt[1]; ans += (t/4)+(t%4!=0); cout << ans << endl; return 0; }
相关文章推荐
- 158B_Taxi
- codeforces-158B-Taxi题解
- Problem--158B--Codeforces--Taxi
- CodeForces 158 B. Taxi(模拟)
- codeforces 158B(Taxi) Java
- CodeForces 158 B. Taxi(模拟)
- CF - 158B - Taxi
- codeforces 158B - Taxi
- 158B - Taxi
- Codeforces 158B - Taxi
- 深入浅出C# 中文版 图文皆译 第四章 类型和引用 page158
- [POJ2060 Taxi Cab Scheme]
- POJ-2060 Taxi Cab Scheme 最小路径覆盖
- Taxi
- Aizu 1318 Long Distance Taxi 最短路
- poj 2060 Taxi Cab Scheme (二分匹配)
- SGU 158.Commuter Train
- sgu158:Commuter Train
- Java:thinging in java p158 exercise 1
- LA 3126 - Taxi Cab Scheme【DAG最小路径覆盖】