#12725: WA line:39


vincent97198 (好想變強喔)

學校 : 國立嘉義高級中學
編號 : 50683
來源 : [104.28.120.128]
最後登入時間 :
2023-07-08 19:46:42

#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++;

}


}

 

不知怎麼沒辦法過,請各位大大幫忙看一下

#12726: Re:WA line:39


vincent97198 (好想變強喔)

學校 : 國立嘉義高級中學
編號 : 50683
來源 : [104.28.120.128]
最後登入時間 :
2023-07-08 19:46:42

#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++;

}


}

 

不知怎麼沒辦法過,請各位大大幫忙看一下



喔喔,沒事,已解決