From 8784cc246987c5b66e944cec95efc4a1730e454b Mon Sep 17 00:00:00 2001 From: KiritoTRw <3021577574@qq.com> Date: Thu, 28 Apr 2016 08:57:02 +0800 Subject: [PATCH] Create 1189.c --- QUSTOJ/1189.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 QUSTOJ/1189.c diff --git a/QUSTOJ/1189.c b/QUSTOJ/1189.c new file mode 100644 index 0000000..be09a9d --- /dev/null +++ b/QUSTOJ/1189.c @@ -0,0 +1,32 @@ +#include +int main() +{ + int plan[12]; + int month,saved,now; + for(month=0,saved=0,now=0;month<12;month++) + { + scanf("%d",&plan[month]); + } + for(month=0;month<12;month++) + { + now+=300; + if(now-plan[month]>=100) + { + saved=saved+((now-plan[month])/100)*100; + now=now-((now-plan[month])/100)*100; + now=now-plan[month]; + continue; + } + else if(now-plan[month]<0) + { + printf("%c%d\n",'-',month+1); + return 0; + } + else + { + now=now-plan[month]; + } + } + printf("%d\n",now+(saved*6)/5); + return 0; +}