11917 - Do Your Own Homework

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

Moderator: Board moderators

rahid
New poster
Posts: 9
Joined: Tue Oct 13, 2009 7:13 am
Location: Asian University of Bangladesh
Contact:

11917 - Do Your Own Homework

Post by rahid » Thu Mar 10, 2011 6:36 am

Please tell me whats wrong with my code??

Code: Select all

CODE HAS BEEN DELETED!!

Last edited by rahid on Fri Mar 11, 2011 4:56 am, edited 1 time in total.

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

Re: 11917 - Do Your Own Homework

Post by naseef_07cuet » Thu Mar 10, 2011 10:39 pm

Check this:
3
compiler 4
cplusplus 1
java 8
5
compiler
2
algorithm 3
math 9
4
math
2
java 8
ai 3
6
calculus

Your program shows for this input set:
Case 1: Yesss2
Case 2: Late2
Case 3: Do your own homework!


There is no new line after the last output.Give it.And delete the extra things that you are printing. Hope it will help you.
If you have determination, you can do anything you want....:)

rahid
New poster
Posts: 9
Joined: Tue Oct 13, 2009 7:13 am
Location: Asian University of Bangladesh
Contact:

Re: 11917 - Do Your Own Homework

Post by rahid » Fri Mar 11, 2011 4:58 am

ThanX for your reply. Problem have been solved just after adding a single new line at the end.

mintae71
New poster
Posts: 18
Joined: Tue Jan 19, 2010 10:50 am

Re: 11917 - Do Your Own Homework

Post by mintae71 » Wed Mar 16, 2011 12:52 pm

Please Help me OTL.......

Code: Select all

#include <iostream>
#include <string>
using namespace std;
string bigeo1[101];
int Dbigeo1[101];
int main()
{
	int testcases, cntofbigeo1;
	int Dbigeo2;
	string bigeo2;
	int i, j;
	int Cases = 0;
	bool last;

	cin >> testcases;

	while (testcases--){
		Cases++;
		last = false;
		for (i = 0; i < 100; i++){
			Dbigeo1[i] = 0;
			bigeo1[i] = "";
		}
		cin >> cntofbigeo1;
		for (i = 0; i < cntofbigeo1; i++){
			cin >> bigeo1[i] >> Dbigeo1[i];
		}

		cin >> Dbigeo2 >> bigeo2;

		for (i = 0; i < cntofbigeo1; i++){
			if (bigeo2.length() == bigeo1[i].length()){
				bool chk = true;

				for (j = 0; j < bigeo1[i].length(); j++){
					if (bigeo1[i][j] != bigeo2[j]){
						chk = false;
						break;
					}
				}

				if (chk == true){
					last = true;
					if (Dbigeo2 >= Dbigeo1[i]) cout << "Case " << Cases << ": " << "Yesss" << endl;
					else if (Dbigeo2+5 >= Dbigeo1[i]) cout << "Case " << Cases << ": " << "Late" << endl;
				}
			}
			if (last) break;
		}
		if (!last) cout << "Case " << Cases << ": " << "Do your own homework!" << endl;
	}
	return 0;
}

lukai
New poster
Posts: 25
Joined: Wed Dec 05, 2012 8:11 pm

11917 - Do Your Own Homework

Post by lukai » Mon Feb 18, 2013 4:36 pm

Code: Select all

#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cstdlib>

using namespace std;

vector<string>subjects;
vector<int>days;
int main()
{
    //freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
    long long int nunu=1,cases,comfortable,day,koydinlage,i;
    string subject,jeitalagbe;
    while(cin>>cases)
    {
        while(cases--)
        {

           cin>>comfortable;
           while(comfortable--)
           {
               cin>>subject>>day;
               subjects.push_back(subject);
               days.push_back(day);
           }
           cin>>koydinlage;
           cin>>jeitalagbe;
           cout<<"Case "<<nunu<<": ";
           nunu++;
           for(i=0;i<subjects.size();i++)
           {
               if(jeitalagbe==subjects[i])
               {
                   if(days[i]<=koydinlage)
                   {
                       cout<<"Yesss"<<endl;
                       break;
                   }
                   else if((koydinlage+5)<=days[i])
                   {
                       cout<<"Late"<<endl;
                       break;
                   }
                   else
                   {
                       cout<<"Do your own homework!"<<endl;
                       break;
                   }
               }

           }
           if(i==subjects.size())
           {
               cout<<"Do your own homework!"<<endl;
           }

            subjects.clear();
            days.clear();
        }
    }

    return 0;
}
Can you give me some critical I/O. I don't understand why I'm getting WA

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

Re: 11917 - Do Your Own Homework

Post by brianfry713 » Thu Feb 21, 2013 12:01 am

Don't read the number of test cases more than once, some problems have junk after the real input.
Check input and AC output for thousands of problems on uDebug!

lukai
New poster
Posts: 25
Joined: Wed Dec 05, 2012 8:11 pm

Re: 11917 - Do Your Own Homework

Post by lukai » Thu Feb 21, 2013 9:34 pm

Code: Select all

#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cstdlib>

using namespace std;

vector<string>subjects;
vector<long long int>days;
int main()
{
   //freopen("input.txt","r",stdin);
   //freopen("output.txt","w",stdout);
    long long int nunu=1,cases,comfortable,day,koydinlage,i;
    string subject,jeitalagbe;
    cin>>cases;

        while(cases--)
        {

           cin>>comfortable;
           while(comfortable--)
           {
               cin>>subject>>day;
               subjects.push_back(subject);
               days.push_back(day);
           }
           cin>>koydinlage;
           cin>>jeitalagbe;
           cout<<"Case "<<nunu<<": ";
           nunu++;
           for(i=0;i<subjects.size();i++)
           {
               if(jeitalagbe==subjects[i])
               {
                   if(days[i]<=koydinlage)
                   {
                       cout<<"Yesss"<<endl;
                       break;
                   }
                   else if((koydinlage+5)<=days[i])
                   {
                       cout<<"Late"<<endl;
                       break;
                   }
                   else
                   {
                       cout<<"Do your own homework!"<<endl;
                       break;
                   }
               }

           }
           if(i==subjects.size())
           {
               cout<<"Do your own homework!"<<endl;
           }

            subjects.clear();
            days.clear();
        }


    return 0;
}
still WA. I am worried :(

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

Re: 11917 - Do Your Own Homework

Post by brianfry713 » Thu Feb 21, 2013 11:20 pm

Input:

Code: Select all

1
2
algorithm 3
math 9
8
math
AC output:

Code: Select all

Case 1: Late
Check input and AC output for thousands of problems on uDebug!

lukai
New poster
Posts: 25
Joined: Wed Dec 05, 2012 8:11 pm

Re: 11917 - Do Your Own Homework

Post by lukai » Sun Feb 24, 2013 9:23 am

can you guve me some more I/O. Getting WA again after fixing the bug.

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

Re: 11917 - Do Your Own Homework

Post by brianfry713 » Mon Feb 25, 2013 10:39 pm

Post your updated code.
Check input and AC output for thousands of problems on uDebug!

sirajul
New poster
Posts: 6
Joined: Sat Mar 23, 2013 12:07 am

Re: 11917 - Do Your Own Homework

Post by sirajul » Sat Mar 23, 2013 4:55 am

Code: Select all

/* deleted after AC */
Last edited by sirajul on Sun Mar 24, 2013 9:04 pm, edited 1 time in total.

sirajul
New poster
Posts: 6
Joined: Sat Mar 23, 2013 12:07 am

Re: 11917 - Do Your Own Homework

Post by sirajul » Sat Mar 23, 2013 4:57 am

Code: Select all

/*deleted after ac*/
Last edited by sirajul on Sun Mar 24, 2013 9:05 pm, edited 1 time in total.

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

Re: 11917 - Do Your Own Homework

Post by brianfry713 » Sun Mar 24, 2013 10:45 am

Input:

Code: Select all

2
3
compiler 4
cplusplus 1
java 8
5
compiler
2
algorithm 3
math 9
4
java
AC output:

Code: Select all

Case 1: Yesss
Case 2: Do your own homework!
Check input and AC output for thousands of problems on uDebug!

sirajul
New poster
Posts: 6
Joined: Sat Mar 23, 2013 12:07 am

Re: 11917 - Do Your Own Homework

Post by sirajul » Sun Mar 24, 2013 9:06 pm

brianfry713 wrote:Input:

Code: Select all

2
3
compiler 4
cplusplus 1
java 8
5
compiler
2
algorithm 3
math 9
4
java
AC output:

Code: Select all

Case 1: Yesss
Case 2: Do your own homework!
just forgot to clear map

sirajul
New poster
Posts: 6
Joined: Sat Mar 23, 2013 12:07 am

Re: 11917 - Do Your Own Homework

Post by sirajul » Sun Mar 24, 2013 9:30 pm

Code: Select all

#include<stdio.h>
#include<string.h>
#include<stdlib.h>

typedef struct MyStruct
{
    char sub[21];
	int days;
	struct MyStruct *next;
} link;

int main()
{
	link *head , *tptr , *nptr;
	int testCaseRunning=1,totalTestCase;
	scanf("%d",&totalTestCase);
	while (testCaseRunning++<=totalTestCase)
	{
		head = tptr = nptr = NULL;
		int subjects;
		scanf("%d",&subjects);
		char c[21];
		int i=0,n;
		for(i=1;i<=subjects;i++)
		{
			scanf("%s %d",c,&n);
			nptr = (link*) malloc(1*sizeof(link));
			strcpy(nptr->sub,c);
			nptr -> days = n;
			nptr -> next = NULL;
			if(head==NULL)
			{
				tptr = head = nptr;
				tptr = nptr ;
			}
			else
			{
				tptr ->next = nptr;
				tptr = nptr;
			}
		}
		scanf("%d",&n);
		scanf("%s",c);
		tptr = head;
		printf("Case %d: ",testCaseRunning-1);
		while (tptr!=NULL && strcmp(tptr->sub,c)!=0)
		{
			tptr = tptr->next;
		}
		if(tptr!=NULL)
		{
			if(strcmp(tptr->sub , c)==0)
			{
				if(tptr->days <= n)
					printf("Yesss\n");
				else if(n+5 <= tptr->days)
					printf("Late\n");
			}
		}
		else
		{
			printf("Do your own homework!\n");
		}
	}
	return 0;
}
Why WA NOW?? !

Post Reply

Return to “Volume 119 (11900-11999)”