| ||||||||||
| 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 | |||||||||
Re:按都不懂乃们为什么要分类,贴In Reply To:贴个简单代码 Posted by:GreatAccepted at 2010-01-25 16:54:07 while (scanf("%lld%lld", &s, &d) != EOF) {
cs = 5, cd = 0;
while (cs * s >= cd * d)
--cs, ++cd;
int64 ans = (cs * s - cd * d) * 2ll;
ans += min(cs, 2ll) * s - max(2ll - cs, 0ll) * d;
if (ans <= 0)
printf("Deficit\n");
else
printf("%lld\n", ans);
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator