Uva 11650 – Mirror Clock

Problem Link Solution :- Mirror Clock C++ /*---------------------------------------------------*/ //Problem Setter: Md. Towhidul Islam //Uva Problem No: 11650 //Problem Name : Mirror Clock //Type : Ad hoc,Analogue clock, Reflection. //Author : Shipu Ahamed //University : BUBT //E-mail : shipuahamed01@gmail.com /*---------------------------------------------------*/ #include <stdio.h> int main() { int t,a,b; scanf("%d", &t); while(t--) { scanf("%d:%d", &a, &b); a=11-a+(b==0); if(a<=0) a=a+12; if(a!=0) b=60-b; if(b==60) b=0; printf("%02d:%02dn",a,b); } return 0; } 123456789101112131415161718192021222324252627282930 /*---------------------------------------------------*///Problem Setter: Md. Towhidul Islam      //Uva Problem No: 11650//Problem Name  : Mirror Clock//Type          : Ad hoc,Analogue clock, Reflection.//Author        : Shipu Ahamed//University    : BUBT//E-mail        : shipuahamed01@gmail.com/*---------------------------------------------------*/ #include <stdio.h>int main() {    int t,a,b;    scanf("%d", &t);    while(t--)    {    scanf("%d:%d", &a, &b);        a=11-a+(b==0);        if(a<=0)        a=a+12;        if(a!=0)        b=60-b;        if(b==60)        b=0;         printf("%02d:%02dn",a,b);    }    return 0;}...

Uva 382 – Perfection

Problem Link Solution :- Perfection C++ #include<stdio.h> int main() { int n,i,j,k,l,m,sum; printf("PERFECTION OUTPUT\n"); while(scanf("%d",&n)==1) { if(n==0) break; sum=0; for(i=1;i<=n/2;i++) { if(n%i==0) sum=sum+i; printf("%d",sum); } if(sum==n) { printf("%5d PERFECT\n",n); } else if(sum<n) { printf("%5d DEFICIENT\n",n); } else { printf("%5d ABUNDANT\n",n); } } printf("END OF OUTPUT\n"); return 0; } 1234567891011121314151617181920212223242526272829303132 #include<stdio.h>int main(){    int n,i,j,k,l,m,sum;    printf("PERFECTION OUTPUT\n");    while(scanf("%d",&n)==1)    {        if(n==0)          break;        sum=0;        for(i=1;i<=n/2;i++)        {            if(n%i==0)               sum=sum+i;               printf("%d",sum);        }        if(sum==n)        {            printf("%5d  PERFECT\n",n);        }        else if(sum<n)        {            printf("%5d  DEFICIENT\n",n);        }        else        {            printf("%5d  ABUNDANT\n",n);        }    }    printf("END OF OUTPUT\n");    return 0;}...

Uva 11185 – Ternary

Problem Link Solution :- C++ /*------------------------------------------------*/<br />//Problem Setter: Shahriar Manzoor<br />//Uva Problem No: 11185<br />//Problem Name : Ternary <br />//Type : Ad hoc.<br />//Author : Shipu Ahamed<br />//University : BUBT<br />//E-mail : shipuahamed01@gmail.com<br />/*--------------------------------------------*/<br /><br />#include&lt;cstdio&gt;<br />#include&lt;cstring&gt;<br />#include&lt;string&gt;<br />#include&lt;cmath&gt;<br />#include&lt;iostream&gt;<br />#include&lt;cctype&gt;<br />#include&lt;map&gt;<br />#include&lt;stack&gt;<br />#include&lt;cstdlib&gt;<br />#include &lt;queue&gt;<br />#include &lt;vector&gt;<br />#include&lt;algorithm&gt;<br />#define ll long long<br />#define sc scanf<br />#define pf printf<br />#define Pi 2*acos(0.0)<br />using namespace std;<br />int main()<br />{<br />long long i,n,j,b[10000];<br />while(scanf("%lld",&amp;n))<br />{<br />if(n&lt;0)<br />break;<br />else if(n==0)<br />{<br />printf("0n");<br />}<br />else<br />{<br />i=0;<br />while(n&gt;0)<br />{<br />b[i]=n%3;<br />n=n/3;<br />i++;<br />}<br />i=i-1;<br />for(j=i;j&gt;=0;j--)<br />printf("%lld",b[j]);<br />printf("n");<br />}<br />}<br />return 0;<br />} 1 /*------------------------------------------------*/<br />//Problem Setter: Shahriar Manzoor<br />//Uva Problem No: 11185<br />//Problem Name  : Ternary <br />//Type          : Ad hoc.<br />//Author        : Shipu Ahamed<br />//University    : BUBT<br />//E-mail        : shipuahamed01@gmail.com<br />/*--------------------------------------------*/<br /><br />#include&lt;cstdio&gt;<br />#include&lt;cstring&gt;<br />#include&lt;string&gt;<br />#include&lt;cmath&gt;<br />#include&lt;iostream&gt;<br />#include&lt;cctype&gt;<br />#include&lt;map&gt;<br />#include&lt;stack&gt;<br />#include&lt;cstdlib&gt;<br />#include &lt;queue&gt;<br />#include &lt;vector&gt;<br />#include&lt;algorithm&gt;<br />#define ll long long<br />#define sc scanf<br />#define pf printf<br />#define Pi 2*acos(0.0)<br />using namespace std;<br />int main()<br />{<br />long long i,n,j,b[10000];<br />while(scanf("%lld",&amp;n))<br />{<br />if(n&lt;0)<br />break;<br />else if(n==0)<br />{<br />printf("0n");<br />}<br />else<br />{<br />i=0;<br />while(n&gt;0)<br />{<br />b[i]=n%3;<br />n=n/3;<br />i++;<br />}<br />i=i-1;<br />for(j=i;j&gt;=0;j--)<br />printf("%lld",b[j]);<br />printf("n");<br />}<br />}<br />return 0;<br />} At First you can try to solve this problem if you can’t than see this code & find what’s your problem . If you copy paste this code you could not improve yourself in programming...

Uva 11044 – Searching for Nessy

Problem:- http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1985 Solution :- #include<stdio.h>  int main()  {     int t,n,m;    scanf(“%d”,&t);    while(t–)    {       scanf(“%d %d”,&n,&m);       printf(“%dn”,(n/3)*(m/3));     }  } At First you can try to solve this problem if you can’t than see this code & find what’s your problem . If you copy paste this code you could not improve yourself in programming...

Uva 299 – Train Swapping

Problem Link Solution :- Train Swapping C++ #include<stdio.h> int main() { int i,j,k,t,n,b,a[100],c; scanf("%d",&t); for(k=1;k<=t;k++) { c=0; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=1;i<n;i++) for(j=n-1;j>=i;j--) if(a[j-1]>a[j]) { c++; b=a[j-1]; a[j-1]=a[j]; a[j]=b; } printf("Optimal train swapping takes %d swaps.\n",c); } return 0; } 12345678910111213141516171819202122232425 #include<stdio.h>int main(){    int i,j,k,t,n,b,a[100],c;    scanf("%d",&t);    for(k=1;k<=t;k++)    {    c=0;    scanf("%d",&n);    for(i=0;i<n;i++)        scanf("%d",&a[i]);     for(i=1;i<n;i++)        for(j=n-1;j>=i;j--)            if(a[j-1]>a[j])                {                c++;                b=a[j-1];                a[j-1]=a[j];                a[j]=b;                }    printf("Optimal train swapping takes %d swaps.\n",c);    }return 0;}...