麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學院 > 開發設計 > 正文

E - Y2K Accounting Bug 題解

2019-11-14 09:46:04
字體:
來源:轉載
供稿:網友
Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for PReparing annual report for MS Inc.All what they remember is that MS Inc. posted a surplus or a deficit each month of 1999 and each month when MS Inc. posted surplus, the amount of surplus was s and each month when MS Inc. posted deficit, the deficit was d. They do not remember which or how many months posted surplus or deficit. MS Inc., unlike other companies, posts their earnings for each consecutive 5 months during a year. ACM knows that each of these 8 postings reported a deficit but they do not know how much. The chief accountant is almost sure that MS Inc. was about to post surplus for the entire year of 1999. Almost but not quite.Write a program, which decides whether MS Inc. suffered a deficit during 1999, or if a surplus for 1999 was possible, what is the maximum amount of surplus that they can post.InputInput is a sequence of lines, each containing two positive integers s and d.OutputFor each line of input, output one line containing either a single integer giving the amount of surplus for the entire year, or output Deficit if it is impossible.Sample Input
59 237375 743200000 8496942500000 8000000Sample Output
11628300612Deficit
題意:每五個月報一次表,這個表一定是虧得,這五個月為1-5,2-6,3-7.......然后你輸入是s和d,s代表的是每月盈利,d代表每月虧損,問你每年最大能賺多少錢。
分6種情況:(x為這五個月中盈利月的個數)1.當x為1時ssssd,ssssd,ss。x為2sssdd,sssdd,ss。x為3ssddd,ssddd,ss。x為4sdddd,sdddd,sd。x為5ddddd,ddddd,dd這時一定虧損,so代碼如下:
#include <iostream>using namespace std;
int main(){ int s,d; int res; while(cin>>s && cin>>d) {  if(d>4*s)res=10*s-2*d;  else if(2*d>3*s)res=8*s-4*d;  else if(3*d>2*s)res=6*(s-d);  else if(4*d>s)res=3*(s-3*d);  else res=-1;  if(res<0)cout<<"Deficit"<<endl;  else cout<<res<<endl; } return 0;}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 欧美 亚洲 视频 | 亚洲一区成人在线 | 久久国产精品久久久久久久久久 | 欧美日韩免费观看视频 | 91在线精品亚洲一区二区 | 免费国产精品视频 | 九九热这里只有精品8 | 成人福利在线视频 | 精国产品一区二区三区四季综 | 黄色网址在线播放 | 欧美日韩亚洲另类 | 黄色大片在线免费观看 | 宅男噜噜噜66国产免费观看 | 在线成人一区 | 九草在线视频 | 国产男女爽爽爽爽爽免费视频 | 思思久而久而蕉人 | 成人福利在线看 | 黄视频免费在线 | 日韩一级成人 | 欧美三级日本三级少妇99 | 龙的两根好大拔不出去h | 欧美成人一级 | 看中国一级毛片 | 欧美日韩在线视频一区 | 成人午夜毛片 | 久草在线视频网 | 欧美黄色大片免费观看 | 国产精品久久久久久久久久 | 日韩高清电影 | 免费a视频在线观看 | 99欧美视频 | 亚洲国产成人久久一区www妖精 | japanese massage tube | 中文字幕一区久久 | 中午字幕无线码一区2020 | 91精品欧美一区二区三区 | 一起草av在线 | 亚洲日韩精品欧美一区二区 | 午夜视频在线观看免费视频 | 欧美成人区 |