11878 - Homework Checker
Moderator: Board moderators
-
- New poster
- Posts: 15
- Joined: Tue Oct 21, 2014 4:08 pm
- Location: Bangladesh
- Contact:
Re: 11878 - Homework Checker
thanks every body for kind help
got accepted now
got accepted now
Last edited by Helaluddin_brur on Thu Nov 20, 2014 9:39 pm, edited 2 times in total.
Re: 11878 - Homework Checker
Use code tags. You should print number of correct answers. You print answers that doesn't match. Problem description says
Print a single integer in a line, the number of correct answers
Acc Output is 0.sohel wrote:Try this caseCode: Select all
1+1=?
Shahidul.CSE wrote:problem was that i didn't control when c<0Code: Select all
Removed after accepted
According to problem description input above is invalid. I didn't checked case when c < 0 and got accepted.brianfry713 wrote:1-2=-1
where a and b are numbers prepared by the teacher (they are guaranteed to be non-negative integers not greater than 100), c is the answer computed by your younger brother and is either a non-negative integer not greater than 200, or a single character `?' (that means, he is unable to compute the answer).
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
-
- Experienced poster
- Posts: 148
- Joined: Sun Jul 13, 2014 4:32 am
- Location: Rangpur, Bangladesh
Re: 11878 - Homework Checker
Dear Helaluddin_brur,
My 1st suggestion to you "please use code tag" to post your code in this forum, that means your code should start with "". You can easily use this by clicking on "Code" above the text box.
Now come to the point.
1) You are printing the correct ans when an answer is wrong, and are doing nothing when ans is correct. But in this problem you are asked to print the number of correct answer, that means you have to print "how many answer is correct". You should take a variable (say Count), and when an answer of your younger brother is correct, increment the value of the variable by 1(that means Count++).
2) I solved this problem by taking input as a single string for each line (i.e. using scanf("%s",&str);). By the way, I don't mean that you should use this approach, it just a hint.
3) remember that output will be just one integer indicating "how many ans are correct".
Hope this help. keep posting . Best of luck .
My 1st suggestion to you "please use code tag" to post your code in this forum, that means your code should start with "
Code: Select all
" and end with
"
Now come to the point.
1) You are printing the correct ans when an answer is wrong, and are doing nothing when ans is correct. But in this problem you are asked to print the number of correct answer, that means you have to print "how many answer is correct". You should take a variable (say Count), and when an answer of your younger brother is correct, increment the value of the variable by 1(that means Count++).
2) I solved this problem by taking input as a single string for each line (i.e. using scanf("%s",&str);). By the way, I don't mean that you should use this approach, it just a hint.
3) remember that output will be just one integer indicating "how many ans are correct".
Hope this help. keep posting . Best of luck .
Md. Shahidul Islam
Dept. of CSE at Begum Rokeya University, Rangpur, Bangladesh
UVa id: http://uhunt.felix-halim.net/id/438420
My facebook account,
Email me: shahidul.cse.brur@gmail.com
Dept. of CSE at Begum Rokeya University, Rangpur, Bangladesh
UVa id: http://uhunt.felix-halim.net/id/438420
My facebook account,
Email me: shahidul.cse.brur@gmail.com
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11878 - Homework Checker
I deleted my invalid input: a, b, and c are non-negative in the judge's input.
Shahidul.CSE
char str[12];
scanf("%s", str) is correct
scanf("%s", &str) is wrong but works
http://stackoverflow.com/questions/5406 ... with-scanf
Shahidul.CSE
char str[12];
scanf("%s", str) is correct
scanf("%s", &str) is wrong but works
http://stackoverflow.com/questions/5406 ... with-scanf
Check input and AC output for thousands of problems on uDebug!
Re: 11878 - Homework Checker
Hi ,
I've got accepted this prob but I have a confusion that is "HOW this program stop taking input"
I use codeblocks and when I run this program it continuously taking input (unless i give a wrong sequence of input ,say ?+?=3) and never showing output .
I'm giving my code for your testing.
Thanks in advance..
I've got accepted this prob but I have a confusion that is "HOW this program stop taking input"
I use codeblocks and when I run this program it continuously taking input (unless i give a wrong sequence of input ,say ?+?=3) and never showing output .
I'm giving my code for your testing.
Code: Select all
Got it
Last edited by mpmohi on Tue Nov 25, 2014 5:49 am, edited 1 time in total.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11878 - Homework Checker
Check input and AC output for thousands of problems on uDebug!
Re: 11878 - Homework Checker
Thank you "brainfry713"
-
- New poster
- Posts: 2
- Joined: Thu Jun 09, 2016 12:01 pm
Re: 11878 - Homework Checker
Can a '-' be appeared between '=' and 'c'. If can how should i treat it ? As invalid input ? And should i print a new line after ans ? uDebug seems to treat "1-2=-1" as a correct ans & put a new line after that.
Re: 11878 - Homework Checker
Problem description says
So '-' can not be appeared. Yes, you should print a new line after answer. Otherwise you'll get wa.c is the answer computed by your younger brother and is either a non-negative integer
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman