Month: August 2012

Uva 11219 – How old are you?

Problem Link

Solution :-

 

Posted by Shipu Ahamed in Programming, Uva, 0 comments

Uva 10696 – f91

 Problem Link

Solution :-

 

Posted by Shipu Ahamed in Programming, Uva, 0 comments

Uva 11805 – Bafana Bafana

Problem Link

Solution :-

 

Posted by Shipu Ahamed in Programming, Uva, 0 comments

Uva 10783 – Odd Sum

Problem:-http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1724



Solution :-

#include<stdio.h>
int main()
{
int a,b,c,s,i,j;
while (scanf(“%d”,&c)==1)
{
for(i=1;i<=c;i++)
{
scanf(“%d %d”,&a,&b);
s=0;
if(a%2==0)
a=a+1;
for(j=a;j<=b;j=j+2)
s+=j;
printf(“Case %d: %dn”,i,s);
}
}
return (0);
}

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 .
Posted by Shipu Ahamed in Programming, Uva, 0 comments

Uva 11150 – Cola

Problem Link

Solution :-

#include<stdio.h>
int main()
{
int a,n;
while(scanf(“%d”,&n)==1)
{
a=n;
while(n>=3)
{
a=a+(n/3);
n=(n/3)+(n%3);
}
if(n==2)
{
a++;
}
printf(“%dn”,a);
}
return 0;
}

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 .
Posted by Shipu Ahamed in Programming, Uva, 0 comments

Uva 10469 – To Carry or not to Carry

Problem Link

Solution :-

Posted by Shipu Ahamed in Programming, Uva, 0 comments

Uva 11727 – Cost Cutting

Problem Link

Solution :-

 

Posted by Shipu Ahamed in Programming, Uva, 0 comments

Uva 11877 – The Coco-Cola Store

Problem Link

Solution :-



#include<stdio.h>
int main(){
    int n;
    while(scanf(“%d”,&n)==1)
    {
    if(n==0)
    break;
    int c=0;
    while(n>=3)
    {
    n=n-3;
    c++;
    n=n+1;
    }
    if(n==2)
    {
    c++;
        printf(“%dn”,c);
    }
    else
        printf(“%dn”,c);
    }
return 0;
}

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 .
Posted by Shipu Ahamed in Programming, Uva, 0 comments

Uva 113 – Power of Cryptography

Problem Link

Solution :-

Posted by Shipu Ahamed in Programming, Uva, 0 comments