Saturday, October 25, 2014

UVA-11498 ( Division of Nlogonia )

 

UVA-11498 ( Division of Nlogonia )

 

0001

#include<stdio.h>
int main()
{
int a,b,c,d,n;
while (1)
{ int i=0;
scanf("%d",&n);
if(n==0)
{
break;
}
scanf("%d %d",&a,&b);
while(i<n)
{
scanf("%d %d",&c,&d);
if(c>a && d>b)
printf("NE\n");
else if(c>a && d<b)
printf("SE\n");
else if(c<a && d<b)
printf("SO\n");
else if (c<a && d>b)
printf("NO\n");
else
printf("divisa\n");
i++;
}
}
return 0;

}


 


UVA-11498 ( Division of Nlogonia ) UVA LINK

UVA-11764 (Jumping Mario) EASY

UVA-11764 (Jumping Mario) EASY

 

Screenshot_9

Screenshot_10

#include<stdio.h>
int main()
{
int N,i,c=1,T;
scanf("%d",&T);
while(0<T)
{
int HIGH =0,LOW =0,a[50];
scanf("%d",&N);
scanf("%d",&a[0]);
if(N==1)
{
printf("Case %d: %d %d\n",c,HIGH,LOW);
}
else
{
for(i=1; i<N; i++)
{
scanf("%d",&a[i]);
if(a[i-1]<a[i])
{
HIGH ++;
}
else if (a[i-1]==a[i])
{
}
else
{
LOW++;
}
}
printf("Case %d: %d %d\n",c,HIGH,LOW);
}
c++;
T--;
}
return 0;
}



UVA-11764 (Jumping Mario) EASY UVA LINK

UVA-12403 (Save Setu)

UVA-12403 (Save Setu)

0001

#include<stdio.h>
int main()
{
char s[100];
int a,sum=0,n;
scanf("%d",&n);
while(0<n)
{
scanf("%s",s);
if(strcmp(s,"donate")==0)
{
scanf("%d",&a);
sum=sum+a;
}
else
{
printf("%d\n",sum);
}

n--;
}
return 0;


}


 


UVA-12403 (Save Setu) UVA link

Friday, October 24, 2014

UVA-11172 (Relational Operator) EASY

UVA-11172–(Relational Operator) EASY

 

Screenshot_8

#include<stdio.h>
int main()
{
int n,a,b,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%d",&a,&b);
if(a>b)
{
printf(">\n");
}
else if (b==a)
{
printf("=\n");
}
else
printf("<\n");
}
return 0;
}


 


UVA-11172–(Relational Operator) Link

UVA-10346 (Peter's Smokes) EASY

10346 - Peter's Smokes.c

 

0001

#include<stdio.h>
int main()
{ int n,K,i,sum,l,p;
while (scanf("%d%d",&n,&K)!=EOF)
{
int sum1=n;
for(i=0;i<n;n=sum)
{
if(n<K)
{
break;
}
l=n/K;
p=n%K;
sum=l+p;
sum1=sum1+l;
}
printf("%d\n",sum1);
}
return 0;
}


10346 - Peter's Smokes UVA link

UVA-11530 (SMS Typing)

UVA-11530 SMS Typing

 

0001

#include<stdio.h>
int main()
{
char a[100];
int n,i,j,total,k=1;

scanf("%d",&n);
char enter=getchar();

for(j=0;j<n;j++)
{
int sum=0,sum1=0,sum2=0,sum3=0;
gets(a);
int l=strlen(a);
for(i=0;i<=l;i++)
{
if(a[i]=='a'||a[i]=='d'||a[i]=='g'||a[i]=='j'||a[i]=='m'||a[i]=='p'||a[i]=='t'||a[i]=='w'||a[i]==' ')
{
sum=sum+1;
}

else if(a[i]=='b'||a[i]=='e'||a[i]=='h'||a[i]=='k'||a[i]=='n'||a[i]=='q'||a[i]=='u'||a[i]=='x')
{
sum1=sum1+2;
}
else if(a[i]=='c'||a[i]=='f'||a[i]=='i'||a[i]=='l'||a[i]=='o'||a[i]=='r'||a[i]=='v'||a[i]=='y')
{
sum2=sum2+3;
}
else if(a[i]=='s'||a[i]=='z')
{
sum3=sum3+4;
}
total=sum+sum1+sum2+sum3;
}
printf("Case #%d: %d\n",k,total);
k++;
}


return 0;

}


UVA-11530 (SMS Typing) UVA link

UVA-12279 ( Emoogle Balance) EASy

12279 - Emoogle Balance

 

00010002

#include<stdio.h>
int main()
{
int n,P,a,i,o;
P=1;
while(scanf("%d",&n)!=EOF)
{
if(n==0)
{
break;
}
int j=0,K=0;
for(i=0; i<n; i++)
{
scanf("%d",&a);
if(a==0)
{
j++;
}
else
{
K++;
}
}
printf("Case %d: %d\n",P,(K-j));
P++;
}
return 0;


}


12279 - Emoogle Balance UVA LINK

Monday, October 20, 2014

UVA-11636 (Hello World!) EASY

 

UVA-11636 (Hello World!) EASY

 

 

0001

0002

#include<stdio.h>
int main()
{
int n,i,m=1;

while(scanf("%d",&n)!=EOF)
{
int k=0,sum=1,sum1;
if(n<0)
{
break;
}
else
{
for(sum1=1; sum1<n; sum1=sum)
{
sum=sum+sum1;
k++;
}
printf("Case %d: ",m);
printf("%d\n",k);
}
m++;
}
return 0;
}


 


UVA-11636 (Hello World!) EASY UVA Link

Saturday, October 18, 2014

UVA-11727 (Cost Cutting) Easy

 

UVA-11727 (Cost Cutting) Easy

 

0001

#include<stdio.h>
int main()
{
int i,T,k=1,a,b,c;

scanf("%d",&T);
for(i=0; i<T; i++)
{
scanf("%d%d%d",&a,&b,&c);
if(a<b&&b<c)
{
printf("Case %d: %d\n",k,b);
}
else if(b<a&&a<c)
{
printf("Case %d: %d\n",k,a);
}
else if(a<c&&c<b)
{
printf("Case %d: %d\n",k,c);
}
else if(a>b&&b>c)
{
printf("Case %d: %d\n",k,b);
}
else if(b>a&&a>c)
{
printf("Case %d: %d\n",k,a);
}
else if(a>c&&c>b)
{
printf("Case %d: %d\n",k,c);
}
k++;
}
return 0;

}



UVA-11727 (Cost Cutting) Easy UVA Link

Friday, October 17, 2014

UVA-11547 ( Automatic Answer) Easy

11547 - Automatic Answer

Capture1

Capture

 

#include<stdio.h>
int main()
{
int t,l,n,j,m;
scanf("%d",&t);
for(j=0;j<t;j++)
{
scanf("%d",&n);
l=((((((n*567)/9)+7492)*235)/47)-498);
m=((l/10)%10);
if(m<0)
{
m=m*(-1);
}
printf("%d\n",m);
}

return 0;

}




UVA-11547 ( Automatic Answer) UVA Link

UVA-10055 (Hashmat the Brave Warrior) EASY

10055-- Hashmat the Brave Warrior.c


0001

#include<stdio.h>
#include<math.h>
int main()
{ long long int i,j,d;
while (scanf("%lld %lld",&i,&j)!=EOF)
{
if(j<i)
{
d=i-j;
printf("%lld\n",d);
}
else if (pow(2,32)<i)
{
return 0;
}
else
{
d=j-i;
printf("%lld\n",d);
}
}
return 0;
}


 


#include<stdio.h>
int main()
{
long long int a,b,c;
while(scanf("%lld%lld",&a,&b)==2)
{
if(a>b)
c=a-b;
else
c=b-a;
printf("%lld\n",c);
}
return 0;
}


10055-- Hashmat the Brave Warrior UVA Link

Discrete Mathematics and its Applications - Rosen - 7th Edition with Solution

Discrete Mathematics and its Applications - Rosen - 7th Edition with Solution





Thursday, October 16, 2014

UVA-12577 (Hajj-e-Akbar) EASY


UVA-12577 (Very Easy)

0001
Capture
//12577 - Hajj-e-Akbar.c
#include<stdio.h>
int main()
{
char c[10];
int i=1;

while(gets(c))
{
if(c[0]=='*')
break;
else if(strcmp(c,"Hajj" )==0)
printf ("Case %d: Hajj-e-Akbar\n",i);
else if(strcmp(c,"Umrah" )==0)
printf ("Case %d: Hajj-e-Asghar\n",i);
i++;
}
return 0;
}


UVA-12577  link

Thursday, October 2, 2014

C প্রোগ্রামিং - 9 অধ্যায়–STring স্ট্রিং function 2

 

####        function name : strupr

একটি স্ট্রিং এ capital letter কে small letter এ পরিনিত করতে ব্যবহিত হয় ।

#include<stdio.h>
int main()
{
char ch[100];
printf("ENter the number = ");
gets(ch);

strupr(ch);
printf("%s",ch);
return 0;

}


Screenshot_4


 


####        function name : strrev

একটি স্ট্রিং কে উলট করতে ব্যবহিত হয় ।


#include<stdio.h>
int main()
{
char ch[100];
printf("ENter the number = ");
gets(ch);

strrev(ch);
printf("%s",ch);
return 0;

}

Screenshot_5

####        function name : strrev

একটি স্ট্রিং এ small letter কে capital letter এ পরিনিত করতে ব্যবহিত হয় । ।


#include<stdio.h>
int main()
{
char ch[100];
printf("ENter the number = ");
gets(ch);

strlwr(ch);
printf("%s",ch);
return 0;

}