URAL 1995 Illegal spices 贪心构造
2017-03-20 20:24
417 查看
题目链接:这里
题意:
有n个物品,然后有k个东西留了下来
如果x/(i-1)
题意:
有n个物品,然后有k个东西留了下来
如果x/(i-1)
//URAL 1995 #include <bits/stdc++.h> using namespace std; const int maxn = 1e5+7; int n, k, p, a[maxn]; int main(){ scanf("%d%d%d", &n, &k, &p); k = n-k; int now = 1, num = 0; for(int i = 1; i <= n; i++){ if(i <= k){ a[i] = 1; num++; } else{ if(100*num >= p*(i-1)){ a[i] = now+1; } else{ now++; num=i-1; a[i] = now+1; } } } long long ans = 0; for(int i = 1; i <= n; i++) ans += a[i]; printf("%lld\n", ans); for(int i = 1; i <= n; i++){ printf("%d%c", a[i], i==n?'\n':' '); } return 0; }
相关文章推荐
- URAL 1995 Illegal spices 贪心构造
- URAL1995-Illegal spices(贪心构造)
- Illegal spices (URAL 1995 YY构造)
- URAL 1995 Illegal spices
- UVRL 1995 Illegal spices(构造)
- HDU-#5014 Number Sequence(贪心+构造)
- CF - 805C. Find Amir - 贪心思维+构造
- Codeforces Round #301 (Div. 2)(A,【模拟】B,【贪心构造】C,【DFS】)
- Ural 1303 Minimal Coverage(贪心)
- ural 1820. Ural Steaks 贪心
- hdu 5113 Black and White(贪心构造)
- [Codeforces432E]Square Tiling(贪心+构造)
- codeforces 748D Santa Claus and a Palindrome (构造+贪心+数据结构)
- Codeforces Round #394 (Div. 2) E. Dasha and Puzzle —— 构造 + 贪心
- Codeforces_394C_Dominoes(贪心构造)
- codeforce 509C (很有趣的贪心模拟构造)
- URAL 2000 Grand Theft Array V 贪心
- Codeforces.911F.Tree Destruction(构造 贪心)
- 【构造】URAL 1979 Resources Distribution
- 【贪心】URAL - 1303 Minimal Coverage