#include<iostream>
using namespace std;
int main()
{
int s,MonthQuit[12],MonthTest[12],trash,tmp=1,sum=0;
while(cin >> s)
{
if(s<0)
{
break;
}
sum=0;
for(int month=0;month<12;month++)
{
cin >> MonthQuit[month];
}
for(int month=0;month<12;month++)
{
cin >> MonthTest[month];
}
cin >> trash;
sum=s+sum;
cout << "Case " << tmp << ":" << endl;
for(int month=0;month<12;month++)
{
if(MonthTest[month] > sum)
{
cout << "No problem. :(" << endl;
}
else
{
cout << "No problem! :D" << endl;
sum=sum-MonthTest[month];
}
sum=MonthQuit[month]+sum;
}
tmp++;
}
}
不知怎麼沒辦法過,請各位大大幫忙看一下
#include
using namespace std;
int main()
{
int s,MonthQuit[12],MonthTest[12],trash,tmp=1,sum=0;
while(cin >> s)
{
if(s<0)
{
break;
}
sum=0;
for(int month=0;month<12;month++)
{
cin >> MonthQuit[month];
}
for(int month=0;month<12;month++)
{
cin >> MonthTest[month];
}
cin >> trash;
sum=s+sum;
cout << "Case " << tmp << ":" << endl;
for(int month=0;month<12;month++)
{
if(MonthTest[month] > sum)
{
cout << "No problem. :(" << endl;
}
else
{
cout << "No problem! :D" << endl;
sum=sum-MonthTest[month];
}
sum=MonthQuit[month]+sum;
}
tmp++;
}
}
不知怎麼沒辦法過,請各位大大幫忙看一下
喔喔,沒事,已解決