Uva 11936 – The Lazy Lumberjacks

Problem Link Solution :- Algo : ত্রিভুজ তখনি হবে যদি যেকোন দুইটি বাহুর যোগফল অপর বাহুর অপেক্ষা বড় হয় । The Lazy Lumberjacks C++ /*------------------------------------------------*/ //Uva Problem No: 11936 //Problem Name : The Lazy Lumberjacks //Type : Ad hoc,Geometry. //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 t; sc("%d",&t); while(t--) { ll a,b,c; sc("%lld%lld%lld",&a,&b,&c); if(a+b>c && b+c>a && a+c>b) pf("OKn"); else pf("Wrong!!n"); } return 0; } 1234567891011121314151617181920212223242526272829303132333435363738394041 /*------------------------------------------------*///Uva Problem No: 11936//Problem Name  : The Lazy Lumberjacks//Type          : Ad hoc,Geometry.//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 t;   sc("%d",&t);   while(t--)   {       ll a,b,c;       sc("%lld%lld%lld",&a,&b,&c);       if(a+b>c && b+c>a && a+c>b)        pf("OKn");       else        pf("Wrong!!n");   }    return 0;}...

Uva 138 – Street Numbers

Problem Link Solution :-    Hints                    : http://www.algorithmist.com/index.php/UVa_138 Street Numbers C++ /*-------------------------------------------------------------*/ //Uva Problem No: 138 //Problem Name : Street Numbers //Type : Math,Bruteforce,Noinput,Ad hoc. //Author : Shipu Ahamed //University : BUBT //E-mail : shipuahamed01@gmail.com /*--------------------------------------------------------------*/ #include<iostream> #include<algorithm> #include<sstream> #include<fstream> #include<utility> #include<cstdlib> #include<cstring> #include<string> #include<bitset> #include<vector> #include<cstdio> #include<cctype> #include<cmath> #include<queue> #include<deque> #include<stack> #include<map> #define ll long long #define sc scanf #define pf printf #define pi 2*acos(0.0) using namespace std; int s[20] = { 6,8, 35,49, 204,288, 1189,1681, 6930,9800, 40391,57121, 235416,332928, 1372105,1940449, 7997214,11309768, 46611179,65918161 }; int main() { for(int i=0;i<20;i+=2) printf("%10d%10dn",s[i],s[i+1]); return 0; } 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 /*-------------------------------------------------------------*///Uva Problem No: 138//Problem Name  : Street Numbers//Type          : Math,Bruteforce,Noinput,Ad hoc.//Author        : Shipu Ahamed//University    : BUBT//E-mail        : shipuahamed01@gmail.com/*--------------------------------------------------------------*/ #include<iostream>#include<algorithm>#include<sstream>#include<fstream>#include<utility>#include<cstdlib>#include<cstring>#include<string>#include<bitset>#include<vector>#include<cstdio>#include<cctype>#include<cmath>#include<queue>#include<deque>#include<stack>#include<map>#define ll long long#define sc scanf#define pf printf#define pi 2*acos(0.0)using namespace std;int s[20] = {6,8,35,49,204,288,1189,1681,6930,9800,40391,57121,235416,332928,1372105,1940449,7997214,11309768,46611179,65918161};int main(){    for(int i=0;i<20;i+=2)    printf("%10d%10dn",s[i],s[i+1]);    return...

Uva 10170 – The Hotel with Infinite Rooms

Problem Link Solution :- C++ /*-----------------------------------------------*/<br />//Problem Setter: Shahriar Manzoor<br />//Uva Problem No: 10170<br />//Problem Name : The Hotel with Infinite Rooms<br />//Type : Number Theory<br />//Author : Shipu Ahamed<br />//University : BUBT<br />//E-mail : shipuahamed01@gmail.com<br />/*-----------------------------------------------*/<br /><br />#include&lt;algorithm&gt;<br />#include&lt;sstream&gt;<br />#include&lt;fstream&gt;<br />#include&lt;utility&gt;<br />#include&lt;cstdlib&gt;<br />#include&lt;cstring&gt;<br />#include&lt;string&gt;<br />#include&lt;bitset&gt;<br />#include&lt;vector&gt;<br />#include&lt;cstdio&gt;<br />#include&lt;cctype&gt;<br />#include&lt;cmath&gt;<br />#include&lt;queue&gt;<br />#include&lt;deque&gt;<br />#include&lt;stack&gt;<br />#include&lt;map&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 />ll day(ll s,ll d)<br />{<br /> ll sum=0,i;<br /> for(i=s;;i++)<br /> {<br /> sum=sum+i;<br /> if(sum&gt;=d)<br /> {<br /> break;<br /> }<br /> }<br /> return i;<br /><br />}<br />int main()<br />{<br /> ll s,d;<br /> while(sc("%lld %lld",&amp;s,&amp;d)==2)<br /> {<br /> pf("%dn",day(s,d));<br /> }<br /> return 0;<br />} 1 /*-----------------------------------------------*/<br />//Problem Setter: Shahriar Manzoor<br />//Uva Problem No: 10170<br />//Problem Name  : The Hotel with Infinite Rooms<br />//Type          : Number Theory<br />//Author        : Shipu Ahamed<br />//University    : BUBT<br />//E-mail        : shipuahamed01@gmail.com<br />/*-----------------------------------------------*/<br /><br />#include&lt;algorithm&gt;<br />#include&lt;sstream&gt;<br />#include&lt;fstream&gt;<br />#include&lt;utility&gt;<br />#include&lt;cstdlib&gt;<br />#include&lt;cstring&gt;<br />#include&lt;string&gt;<br />#include&lt;bitset&gt;<br />#include&lt;vector&gt;<br />#include&lt;cstdio&gt;<br />#include&lt;cctype&gt;<br />#include&lt;cmath&gt;<br />#include&lt;queue&gt;<br />#include&lt;deque&gt;<br />#include&lt;stack&gt;<br />#include&lt;map&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 />ll day(ll s,ll d)<br />{<br />    ll sum=0,i;<br />    for(i=s;;i++)<br />    {<br />        sum=sum+i;<br />        if(sum&gt;=d)<br />        {<br />            break;<br />        }<br />    }<br />    return i;<br /><br />}<br />int main()<br />{<br />    ll s,d;<br />    while(sc("%lld %lld",&amp;s,&amp;d)==2)<br />    {<br />        pf("%dn",day(s,d));<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 401 – Palindromes

Problem Link Solution :- Palindromes C++ /*-----------------------------------------------*/ //Problem Name : Palindromes //Uva Problem No: 401 //Type : Ad hoc, Strings, Palindromes. //Author : Shipu Ahamed //University : BUBT //E-mail : shipuahamed01@gmail.com /*-----------------------------------------------*/ #include<iostream> #include<algorithm> #include<sstream> #include<fstream> #include<utility> #include<cstdlib> #include<cstring> #include<string> #include<bitset> #include<vector> #include<cstdio> #include<cctype> #include<cmath> #include<queue> #include<deque> #include<stack> #include<map> #define ll long long #define sc scanf #define pf printf #define pi 2*acos(0.0) using namespace std; int main() { string s,a,b; char m[3000]; memset(m,NULL,sizeof(m)); m['A']='A'; m['E']='3'; m['H']='H'; m['I']='I'; m['J']='L'; m['L']='J'; m['M']='M'; m['O']='O'; m['S']='2'; m['T']='T'; m['U']='U'; m['V']='V'; m['W']='W'; m['X']='X'; m['Y']='Y'; m['Z']='5'; m['1']='1'; m['2']='S'; m['3']='E'; m['5']='Z'; m['8']='8'; while(cin>>s){ a=b=""; int len=s.size(); for(int i=len-1;i>=0;i--) { a+=s[i]; b+=m[s[i]]; } if (s==a && s==b) cout<<s<<" -- is a mirrored palindrome."<<endl<<endl; else if (s==a && s!=b) cout<<s<<" -- is a regular palindrome."<<endl<<endl; else if (s!=a && s==b) cout<<s<<" -- is a mirrored string."<<endl<<endl; else cout<<s<<" -- is not a palindrome."<<endl<<endl; } return 0; } 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 /*-----------------------------------------------*///Problem Name  : Palindromes//Uva Problem No: 401//Type          : Ad hoc, Strings, Palindromes.//Author        : Shipu Ahamed//University    : BUBT//E-mail        : shipuahamed01@gmail.com/*-----------------------------------------------*/ #include<iostream>#include<algorithm>#include<sstream>#include<fstream>#include<utility>#include<cstdlib>#include<cstring>#include<string>#include<bitset>#include<vector>#include<cstdio>#include<cctype>#include<cmath>#include<queue>#include<deque>#include<stack>#include<map>#define ll long long#define sc scanf#define pf printf#define pi 2*acos(0.0)using namespace std;int main(){ string s,a,b; char m[3000];  memset(m,NULL,sizeof(m)); m['A']='A'; m['E']='3'; m['H']='H'; m['I']='I'; m['J']='L'; m['L']='J'; m['M']='M'; m['O']='O'; m['S']='2'; m['T']='T'; m['U']='U'; m['V']='V'; m['W']='W'; m['X']='X'; m['Y']='Y'; m['Z']='5'; m['1']='1'; m['2']='S'; m['3']='E'; m['5']='Z'; m['8']='8'; while(cin>>s){  a=b="";  int len=s.size();  for(int i=len-1;i>=0;i--)  {      a+=s[i];      b+=m[s[i]];  }  if (s==a && s==b)  cout<<s<<" -- is a mirrored palindrome."<<endl<<endl;  else if (s==a && s!=b)   cout<<s<<" -- is a regular palindrome."<<endl<<endl;  else if (s!=a && s==b)  cout<<s<<" -- is a mirrored string."<<endl<<endl;  else   cout<<s<<" -- is not a palindrome."<<endl<<endl; } return 0;}...