Page 2 of 2

Re: 11608 - No Problem

Posted: Fri Oct 22, 2010 6:16 pm
by omegacfx
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;
}

Re: 11608 - No Problem

Posted: Sat Oct 23, 2010 6:34 pm
by helloneo
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

Re: 11608 - No Problem

Posted: Wed Mar 09, 2011 1:46 am
by naseef_07cuet
It is a simple problem....

Re: 11608 - No Problem

Posted: Mon Apr 25, 2011 2:15 pm
by anik.bit0104

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?

Re: 11608 - No Problem

Posted: Tue Dec 17, 2013 4:37 am
by arkhels
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 */

Re: 11608 - No Problem

Posted: Tue Dec 17, 2013 4:52 am
by LucasSchm
Here:
printf("Case %d: \n",cs++);

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

Re: 11608 - No Problem

Posted: Tue Dec 17, 2013 10:00 am
by arkhels
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

Re: 11608 - No Problem

Posted: Sun Jun 15, 2014 1:56 pm
by Faithkeeper_Rangwan
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;
}

Re: 11608 - No Problem

Posted: Mon Jun 16, 2014 9:15 pm
by brianfry713
Delete line 8:
problem[12] = 0;

Re: 11608 - No Problem

Posted: Sun Dec 28, 2014 7:30 am
by icansolve
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];
        }   
    }   
}

Re: 11608 - No Problem

Posted: Tue Jan 06, 2015 5:41 am
by brianfry713
Use class Main