Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
如此水题,害人不浅。。。。。一看分类竟然是贪心,不知所措啊。。(今天刚学贪心,啥也不会),后面试了下暴力,RP爆发啊。。。一次就A了。。。。。0ms。。。 把史上最简单的代码给初学者分享: #include<iostream> #include<algorithm> using namespace std; int main() { int tot; int i; int num[13]; while (scanf("%d", &tot) == 1) { if (tot == 0) return 0; for (i = 0; i <= tot; i++) scanf("%d", &num[i]); while (num[tot] > 0) { sort(num, num + tot); num[0]++; num[1]++; num[2]++; num[tot]--; } if (num[tot] == 0) { sort(num, num + tot); if (num[tot - 1] % 50 == 0) printf("%d\n", num[tot - 1] / 50); else printf("%d\n", num[tot - 1] / 50 + 1); } } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator