Uva 11777 – Automate the Grades

Problem Link Solution :- Automate the Grades C++ /*------------------------------------------------*/ //Problem Setter: Sohel Hafiz //Uva Problem No: 11777 //Problem Name : Automate the Grades //Type : Ad hoc //Author : Shipu Ahamed //University : BUBT //E-mail : shipuahamed01@gmail.com /*-----------------------------------------------*/ #include<stdio.h> int main() { int t1,t2,f,at,ct1,ct2,ct3,c,d,n,i; while(scanf("%d",&n)==1) { for(i=1;i<=n;i++) { scanf("%d%d%d%d%d%d%d",&t1,&t2,&f,&at,&ct1,&ct2,&ct3); if(ct1<=ct2 && ct1<=ct3) c=(ct2+ct3)/2; else if(ct2<=ct1 && ct2<=ct3) c=(ct1+ct3)/2; else if(ct3<=ct1 && ct3<=ct2) c=(ct1+ct2)/2; d=t1+t2+f+at+c; if(d>=90) printf("Case %d: An",i); else if(d>=80) printf("Case %d: Bn",i); else if(d>=70) printf("Case %d: Cn",i); else if(d>=60) printf("Case %d: Dn",i); else if(d<60) printf("Case %d: Fn",i); } } return 0; } 12345678910111213141516171819202122232425262728293031323334353637383940 /*------------------------------------------------*///Problem Setter: Sohel Hafiz//Uva Problem No: 11777//Problem Name  : Automate the Grades//Type          : Ad hoc//Author        : Shipu Ahamed//University    : BUBT//E-mail        : shipuahamed01@gmail.com/*-----------------------------------------------*/ #include<stdio.h>int main(){    int t1,t2,f,at,ct1,ct2,ct3,c,d,n,i;    while(scanf("%d",&n)==1)    {        for(i=1;i<=n;i++)        {        scanf("%d%d%d%d%d%d%d",&t1,&t2,&f,&at,&ct1,&ct2,&ct3);        if(ct1<=ct2 && ct1<=ct3)        c=(ct2+ct3)/2;        else if(ct2<=ct1 && ct2<=ct3)        c=(ct1+ct3)/2;        else if(ct3<=ct1 && ct3<=ct2)        c=(ct1+ct2)/2;        d=t1+t2+f+at+c;        if(d>=90)        printf("Case %d: An",i);        else if(d>=80)        printf("Case %d: Bn",i);        else if(d>=70)        printf("Case %d: Cn",i);        else if(d>=60)        printf("Case %d: Dn",i);        else if(d<60)        printf("Case %d: Fn",i);        }    }    return 0;}...

Uva 11875 – Brick Game

Problem Link Solution :- Brick Game C++ /*------------------------------------------------*/ //Problem Setter: Md. Arifuzzaman Arif //Uva Problem No: 11875 //Problem Name : Brick Game //Type : Ad hoc //Author : Shipu Ahamed //University : BUBT //E-mail : shipuahamed01@gmail.com /*--------------------------------------------*/ #include<stdio.h> #include<algorithm> #include<stdlib.h> using namespace std; int main() { int n,i,a[12],t,p,mem; while(scanf("%d",&n)==1) { t=1; while(n--) { scanf("%d",&mem); for(i=0;i<mem;i++) scanf("%d",&a[i]); sort(a,a+i); p=mem/2; printf("Case %d: %dn",t++,a[p]); } } return 0; } 1234567891011121314151617181920212223242526272829303132 /*------------------------------------------------*///Problem Setter: Md. Arifuzzaman Arif//Uva Problem No: 11875//Problem Name  : Brick Game//Type          : Ad hoc//Author        : Shipu Ahamed//University    : BUBT//E-mail        : shipuahamed01@gmail.com/*--------------------------------------------*/ #include<stdio.h>#include<algorithm>#include<stdlib.h>using namespace std;int main(){    int n,i,a[12],t,p,mem;    while(scanf("%d",&n)==1)    {        t=1;        while(n--)        {            scanf("%d",&mem);            for(i=0;i<mem;i++)            scanf("%d",&a[i]);            sort(a,a+i);            p=mem/2;            printf("Case %d: %dn",t++,a[p]);        }    }    return 0;}...

Uva 11878 – Homework Checker

Problem Link Solution :- Homework Checker C++ /*------------------------------------------------*/ //Problem Setter: Rujia Liu //Uva Problem No: 11878 //Problem Name : Homework Checker //Type : Ad hoc //Author : Shipu Ahamed //University : BUBT //E-mail : shipuahamed01@gmail.com /*--------------------------------------------*/ #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<iostream> #include<cctype> #include<map> #include<stack> #include<cstdlib> #include <queue> #include <vector> #include<algorithm> #define ll long long #define sc scanf #define pf printf #define Pi 2*acos(0.0) using namespace std; int main() { int a,b,count=0; char sine,c[1000]; while(sc("%d%c%d=%s",&a,&sine,&b,c)==4) { if(sine=='+') { if(a+b==atoi(c)) count++; } else if(sine=='-') { if(a-b==atoi(c)) count++; } } pf("%dn",count); return 0; } 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 /*------------------------------------------------*///Problem Setter: Rujia Liu//Uva Problem No: 11878//Problem Name  : Homework Checker//Type          : Ad hoc//Author        : Shipu Ahamed//University    : BUBT//E-mail        : shipuahamed01@gmail.com/*--------------------------------------------*/ #include<cstdio>#include<cstring>#include<string>#include<cmath>#include<iostream>#include<cctype>#include<map>#include<stack>#include<cstdlib>#include <queue>#include <vector>#include<algorithm>#define ll long long#define sc scanf#define pf printf#define Pi 2*acos(0.0)using namespace std;int main(){    int a,b,count=0;    char sine,c[1000];    while(sc("%d%c%d=%s",&a,&sine,&b,c)==4)    {        if(sine=='+')        {            if(a+b==atoi(c))            count++;        }        else if(sine=='-')        {            if(a-b==atoi(c))            count++;        }    }    pf("%dn",count);    return 0;}...

Uva 11879 – Multiple of 17

Problem Link Solution :- Multiple of 17 C++ /*------------------------------------------------*/ //Problem Setter: Rujia Liu //Uva Problem No: 11879 //Problem Name : Multiple of 17 //Type : Ad hoc //Author : Shipu Ahamed //University : BUBT //E-mail : shipuahamed01@gmail.com /*--------------------------------------------*/ #include<stdio.h> #include<string.h> int main() { int i,sum,r,l; char s[1020]; while(gets(s)) { r=0; l=strlen(s); if(l==1 && s[0]=='0') break; for(i=0;i<l;i++) { sum=r*10+(s[i]-'0'); r=sum%17; } if(r==0) printf("1n"); else printf("0n"); } return 0; } 12345678910111213141516171819202122232425262728293031323334 /*------------------------------------------------*///Problem Setter: Rujia Liu//Uva Problem No: 11879//Problem Name  : Multiple of 17//Type          : Ad hoc//Author        : Shipu Ahamed//University    : BUBT//E-mail        : shipuahamed01@gmail.com/*--------------------------------------------*/ #include<stdio.h>#include<string.h>int main(){    int i,sum,r,l;    char s[1020];    while(gets(s))    {        r=0;        l=strlen(s);        if(l==1 && s[0]=='0')        break;        for(i=0;i<l;i++)        {        sum=r*10+(s[i]-'0');        r=sum%17;        }        if(r==0)        printf("1n");        else        printf("0n");    }    return 0;}...

Uva 11942 – Lumberjack Sequencing

Problem Link Solution :- Lumberjack Sequencing C++ /*------------------------------------------------*/ //Uva Problem No: 11942 //Problem Name : Lumberjack Sequencing //Type : Ad hoc. //Author : Shipu Ahamed //University : BUBT //E-mail : shipuahamed01@gmail.com /*--------------------------------------------*/ #include<stdio.h> int main() { int n,c,i,a[15],up,down; printf("Lumberjacks:n"); while(scanf("%d",&n)==1) { while(n--) { for(i=0;i<10;i++) { scanf("%d",&a[i]); } up=a[0]; down=a[1]; if(up>down) { c=0; for(i=0;i<9;i++) { if(a[i]>a[i+1]) { c++; } } } else if(up<down) { c=0; for(i=0;i<9;i++) { if(a[i]<a[i+1]) { c++; } } } if(c==9) printf("Orderedn"); else printf("Unorderedn"); } } return 0; } 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 /*------------------------------------------------*///Uva Problem No: 11942//Problem Name  : Lumberjack Sequencing//Type          : Ad hoc.//Author        : Shipu Ahamed//University    : BUBT//E-mail        : shipuahamed01@gmail.com/*--------------------------------------------*/ #include<stdio.h>int main(){    int n,c,i,a[15],up,down;    printf("Lumberjacks:n");    while(scanf("%d",&n)==1)    {        while(n--)        {            for(i=0;i<10;i++)            {                scanf("%d",&a[i]);            }            up=a[0];            down=a[1];             if(up>down)            {                c=0;                for(i=0;i<9;i++)                {                if(a[i]>a[i+1])                {                c++;                }                }            }            else if(up<down)            {                c=0;                for(i=0;i<9;i++)                {                if(a[i]<a[i+1])                {                c++;                }                }            }             if(c==9)            printf("Orderedn");            else            printf("Unorderedn");         }    }    return 0;}...