11777 - Automate the Grades

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

Moderator: Board moderators

@mjad
New poster
Posts: 44
Joined: Thu Jul 22, 2010 9:42 am

11777 - Automate the Grades

Post by @mjad »

please help me

Code: Select all

#include<stdio.h>

int main() {
    int ks =0,term1,term2,term3, term4, at1,at2,at3,total, min ,n;
    //freopen("input.txt", "r",stdin);

    scanf("%d", &n);
    for( ; n > 0; n--) {
        total = 0;
        ks++;
        scanf("%d%d%d%d%d%d%d", &term1, &term2, &term3, &term4, &at1, &at2,&at3);
        total = term1+term2+term3+term4;
        min = at1;
        min = min < at2 ? min : at2;
        min = min < at3 ? min : at3;

        total = total + (( at1 + at2 + at3 - min) / 2.0);
        if( total >= 90)
            printf("Case %d: %c\n",ks,'A');
        else  if( total >= 80)
            printf("Case %d: %c\n",ks,'B');
        else if( total >= 7)
            printf("Case %d: %c\n",ks,'C');
        else if( total >= 6)
            printf("Case %d: %c\n",ks,'D');
        else
            printf("Case %d: %c\n",ks,'F');
    }
    return 0;
}

robot
New poster
Posts: 29
Joined: Sun May 24, 2009 8:39 pm

Re: 11777 why no AC?

Post by robot »

please check ur code condition
else if( total >= 7) ---> else if( total >= 70)
printf("Case %d: %c\n",ks,'C');
else if( total >= 6) ----> else if( total >= 60)
printf("Case %d: %c\n",ks,'D');

ASU(SUST) :)
john_cu_cse
New poster
Posts: 5
Joined: Mon Mar 21, 2011 4:53 pm

Re: 11777 why no AC?

Post by john_cu_cse »

why it gives wrong answer


#include<stdio.h>
int main()
{
int a,b,c,d,e,f,g,i,t,sum,total;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
scanf("%d%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f,&g);
if(e<f&&e<g||e==f&&f==g)
sum=(f+g)/2;
else
{
if(f<e&&f<g||e==f&&f==g)
sum=(e+g)/2;
else
{
if(g<e&&g<f||e==f&&f==g)
sum=(e+f)/2;
}
}
total=a+b+c+d+sum;
if(total>=90)
printf("Case %d: %c\n",i,'A');
else if(total>=80&&total<90)
printf("Case %d: %c\n",i,'B');
else if(total>=70&&total<80)
printf("Case %d: %c\n",i,'C');
else if(total>=60&&total<70)
printf("Case %d: %c\n",i,'D');
else if(total<60)
printf("Case %d: %c\n",i,'F');
}
return 0;
}
cse.mehedi
New poster
Posts: 36
Joined: Sun Mar 18, 2012 8:18 am

11777 why not AC?

Post by cse.mehedi »

Thank you brianfry713
:) :) :)

Code: Select all

Accepted
Last edited by cse.mehedi on Wed Mar 21, 2012 5:57 pm, edited 1 time in total.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11777 why not AC?

Post by brianfry713 »

Input:

Code: Select all

6
20 20 21 10 0 19 20
20 20 21 10 0 20 19
20 20 21 10 19 0 20
20 20 21 10 20 0 19
20 20 21 10 19 20 0
20 20 21 10 20 19 0
AC output:

Code: Select all

Case 1: A
Case 2: A
Case 3: A
Case 4: A
Case 5: A
Case 6: A
Check input and AC output for thousands of problems on uDebug!
graph_dp
New poster
Posts: 7
Joined: Fri Sep 14, 2012 8:33 am

uva=11777 getting wa...why?

Post by graph_dp »

WHY I AM GETTING WA.........
---------------------------------------------
#include <iostream>
#include <algorithm>

using namespace std;

int main(){


int kase;
cin>>kase;int k=1;
while(kase--){
int a[4],i,j,n,res,sum1;
int sum=0;
for(i=0;i<4;i++){
cin>>n;
sum+=n;}
for(j=0;j<3;j++){
cin>>a[j];

}
sort(a,a+3);
res=(a[1]+a[2])/2;int m=0;
sum1=res+sum;
if(sum1>=90 && m==0){
cout<<"Case "<<k<<": "<<"A"<<endl;m=1;}
if(sum1>=80 && sum1<90 && m==0){
cout<<"Case "<<k<<": "<<"B"<<endl;m=1;}
if(sum1>=70 && sum1<80 && m==0){
cout<<"Case "<<k<<": "<<"C"<<endl;m=1;}
if(sum1>=60 && sum1>70 && m==0){
cout<<"Case "<<k<<": "<<"D"<<endl;m=1;}
if(sum1<60 && m==0){
cout<<"Case "<<k<<": "<<"F"<<endl;m=1;}




k++;
}






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

Re: uva=11777 getting wa...why?

Post by brianfry713 »

Check line 30.
Check input and AC output for thousands of problems on uDebug!
shuvrothpol1
New poster
Posts: 17
Joined: Wed Aug 15, 2012 12:37 pm

Re: uva=11777 getting wa...why?

Post by shuvrothpol1 »

wa :-?
#include <stdio.h>

int main ()

{
int t,j,i,a[7],total,x=0,ct;
scanf ("%d",&t);

for (j=0;j<t;j++)
{total=0;
scanf ("%d%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5],&a[6]);

if ( a[4]+a[5]>a[4]+a[6]&&a[4]+a[5]>a[5]+a[6] )
total+=a[4]+a[5]/2;
else if ( a[5]+a[6]>a[4]+a[5]&&a[5]+a[6]>a[4]+a[6] )
total+=a[5]+a[6]/2;
else
total+=a[4]+a[6]/2;


total+=a[0]+a[1]+a[2]+a[3];

if (total>=90)
printf ("Case %d: A\n",++x);

else if (total>=80&&total<90)
printf ("Case %d: B\n",++x);
else if (total>=70&&total<80)
printf ("Case %d: C\n",++x);
else if (total>=60&&total<70)
printf ("Case %d: D\n",++x);
else
printf ("Case %d: F\n",++x);

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

Re: uva=11777 getting wa...why?

Post by brianfry713 »

Doesn't match the sample I/O.
Check input and AC output for thousands of problems on uDebug!
shuvrothpol1
New poster
Posts: 17
Joined: Wed Aug 15, 2012 12:37 pm

Re: uva=11777 getting wa...why?

Post by shuvrothpol1 »

But I can't understand what the wrong is???? plz give me any hints....
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: uva=11777 getting wa...why?

Post by brianfry713 »

The third case of the sample input is: 20 20 30 10 18 0 0. Your code prints A, it should be B. 20+20+30+10+(18+0)/2=89.
Check input and AC output for thousands of problems on uDebug!
mazid
New poster
Posts: 6
Joined: Sun Dec 23, 2012 9:16 am

11777 - Automate the Grades Why getting WA???

Post by mazid »

Where is the problem?? Please help me..

Code: Select all

AC  :D 
Last edited by mazid on Fri Feb 22, 2013 8:09 pm, edited 1 time in total.
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11777 - Automate the Grades Why getting WA???

Post by brianfry713 »

You're not printing the case number correctly if they get an F.
Check input and AC output for thousands of problems on uDebug!
mazid
New poster
Posts: 6
Joined: Sun Dec 23, 2012 9:16 am

Re: 11777 - Automate the Grades Why getting WA???

Post by mazid »

OPS!!! Very silly mistake... Thanks brianfry713.
KaziInzamamMahmud
New poster
Posts: 9
Joined: Sun Jul 21, 2013 2:34 pm

Re: 11777 - Automate the Grades Why getting WA???

Post by KaziInzamamMahmud »

WA....help please....no idea why WA ?????????
http://ideone.com/eifeo9
Post Reply

Return to “Volume 117 (11700-11799)”