## 11608 - No Problem

All about problems in Volume 116. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

omegacfx
New poster
Posts: 1
Joined: Fri Oct 22, 2010 6:13 pm

### Re: 11608 - No Problem

I'm getting WA on this problem, the test case works and the other test case that someone posted in here works, not sure what is going on.
Thanks!

Code: Select all

``````//no problem
#include <iostream>
using namespace std;

int main(){
int months[15], probs[15];
int probstart, probtotal;
int count = 0;
while(cin >> probstart){
count++;

if (probstart < 0){
return 0;
}

for (int i = 0; i < 12; i++){
cin >> months[i];
}
for (int j = 0; j < 12; j++){
cin >> probs[j];
}
cout << "Case " << count << ":" << endl;
probtotal = probstart;
for (int k = 0; k < 12; k++){

if (probtotal >=  probs[k]){
probtotal = probtotal - probs[k];

cout << "No problem! :D" << endl;

}
else{
cout << "No problem. :(" << endl;

}
probtotal = probtotal + months[k + 1];

}
}

return 0;
}
``````

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

### Re: 11608 - No Problem

Try this case

Code: Select all

``````1
0 10 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1
-1``````
My output is..

Code: Select all

``````Case 1:
No problem! :D
No problem. :(
No problem! :D
No problem! :D
No problem! :D
No problem! :D
No problem! :D
No problem! :D
No problem! :D
No problem! :D
No problem! :D
No problem! :D``````

naseef_07cuet
Learning poster
Posts: 62
Joined: Sat Nov 21, 2009 10:17 pm
Location: CUET,Chittagong,Bangladesh

### Re: 11608 - No Problem

It is a simple problem....
If you have determination, you can do anything you want....

anik.bit0104
New poster
Posts: 6
Joined: Thu Sep 23, 2010 1:50 pm
Location: Dhaka, Bangladesh

### Re: 11608 - No Problem

Code: Select all

``````#include <algorithm>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <string>
#include <vector>
#include <stdio.h>

using namespace std;

int main()
{
int caseCounter=0;

int inp;
int oneInp;
vector <int> arr1;
int extra=0;
vector <int> arr2;

freopen("in","r",stdin);

while (scanf("%d",&inp)==1)
{
caseCounter++;

if (inp<0) break;

cout<<"Case "<<caseCounter<<":"<<endl;

arr1.push_back(inp);

for (int i=0;i<12 ;i++ )
{
cin>>oneInp;
arr1.push_back(oneInp);

}
arr1.erase(arr1.end()-1);

for (int i=0;i<12 ;i++ )
{
cin>>oneInp;
arr2.push_back(oneInp);
}

for (int i=0;i<12 ;i++ )
{

arr1[i]=arr1[i]+extra;

if (arr1[i]>=arr2[i])
{

cout<<"No problem! :D"<<endl;

extra=arr1[i]-arr2[i];
}

else
{
cout<<"No problem. :("<<endl;
extra=extra+arr1[i];
}

}

arr1.clear();
arr2.clear();
extra=0;

}

return 0;
}
``````
It gives correct result for every test case mentioned here or that problem page, still i'm getting just WA. Can please someone tell me, what my problem is?

arkhels
New poster
Posts: 4
Joined: Mon Dec 16, 2013 6:32 pm

### Re: 11608 - No Problem

I got Presentetion Error (PE) , i didn't know what the meaning n where am i wrong, can anyone help me pleaseee

my Code:

/* Accepted */
Last edited by arkhels on Tue Dec 17, 2013 9:59 am, edited 1 time in total.

LucasSchm
New poster
Posts: 17
Joined: Mon May 18, 2009 10:00 pm

### Re: 11608 - No Problem

Here:
printf("Case %d: \n",cs++);

You have an space after the : and before \n.

arkhels
New poster
Posts: 4
Joined: Mon Dec 16, 2013 6:32 pm

### Re: 11608 - No Problem

LucasSchm wrote:Here:
printf("Case %d: \n",cs++);

You have an space after the : and before \n.
thanks , I spent my day and night just to think what the meaning of "presentation error", haha XP

Faithkeeper_Rangwan
New poster
Posts: 12
Joined: Sun Jul 07, 2013 7:32 pm

### Re: 11608 - No Problem

I got WA testing all the test cases mentioned. Is there anything left out in this code?

Code: Select all

``````#include<cstdio>
int problem[12];
int use[12];
int main()
{
int ready;
int count = 1;
problem[12] = 0;
scanf("%d",&ready);
while(ready>0)
{
for(int i = 0; i<12; i++) scanf("%d",&problem[i]);
for(int i = 0; i<12; i++) scanf("%d",&use[i]);
printf("Case %d:\n",count++);
for(int i = 0; i<12; i++)
{
if(ready<use[i]) puts("No problem. :(");
else
{
puts("No problem! :D");
ready-=use[i];
}
ready+=problem[i];
}
scanf("%d",&ready);
}
return 0;
}``````

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 11608 - No Problem

Delete line 8:
problem[12] = 0;
Check input and AC output for thousands of problems on uDebug!

icansolve
New poster
Posts: 3
Joined: Sun Dec 21, 2014 12:18 pm

### Re: 11608 - No Problem

Hey guys although i've passed the test cases mentioned in this forum, I'm still getting WA...

Code: Select all

``````import java.util.*;

public class Problem{
private static final int MAX_SIZE = 12;
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int problem, test = 1;

while((problem = sc.nextInt()) > 0){
int[] create = new int[MAX_SIZE];
int[] require = new int[MAX_SIZE];

scanArr(create, sc);
scanArr(require, sc);
System.out.println("Case " + test + ":");
checkProblem(create, require, problem);

test++;
}
}

private static void scanArr(int[] arr, Scanner sc){
for(int i = 0; i < 12; i++)
arr[i] = sc.nextInt();
}

private static void checkProblem(int[] create, int[] require, int problem){
for(int i = 0; i < 12; i++){
if(problem >= require[i]){
problem -= require[i];
System.out.println("No problem! :D");
}
else System.out.println("No problem. :(");
problem += create[i];
}
}
}
``````

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

### Re: 11608 - No Problem

Use class Main
Check input and AC output for thousands of problems on uDebug!