Uva 11172 – Relational Operator

Problem Link Solution :- Relational Operator C++ /*------------------------------------------------*/ //Problem Setter: Shahriar Manzoor //Uva Problem No: 11172 //Problem Name : Relational Operators //Type : Ad hoc //Author : Shipu Ahamed //University : BUBT //E-mail : shipuahamed01@gmail.com /*--------------------------------------------*/ #include<stdio.h> int main() { int a,b,t; scanf("%d",&t); while(t--) { scanf("%d %d",&a,&b); if(a<b) printf("<n"); else if(a>b) printf(">n"); else printf("=n"); } return 0; } 123456789101112131415161718192021222324252627 /*------------------------------------------------*///Problem Setter: Shahriar Manzoor//Uva Problem No: 11172//Problem Name  : Relational Operators//Type          : Ad hoc//Author        : Shipu Ahamed//University    : BUBT//E-mail        : shipuahamed01@gmail.com/*--------------------------------------------*/ #include<stdio.h>int main(){  int a,b,t;  scanf("%d",&t);  while(t--)  {       scanf("%d %d",&a,&b);       if(a<b)       printf("<n");       else if(a>b)       printf(">n");       else       printf("=n");  }  return 0;}...

Uva 10071 – Back to High School Physics

Problem Link Solution :- Back to High School Physics C++ /*------------------------------------------------*/ //Problem Setter: Shahriar Manzoor //Uva Problem No: 11172 //Problem Name : Back to High School Physics //Type : Ad hoc //Author : Shipu Ahamed //University : BUBT //E-mail : shipuahamed01@gmail.com /*--------------------------------------------*/ #include<stdio.h> int main() { int v,t; while(scanf("%d %d",&v,&t)==2) { if(v==0 && t==0) printf("0n"); else printf("%dn",2*v*t); } return 0; } 1234567891011121314151617181920212223 /*------------------------------------------------*///Problem Setter: Shahriar Manzoor//Uva Problem No: 11172//Problem Name  : Back to High School Physics//Type          : Ad hoc//Author        : Shipu Ahamed//University    : BUBT//E-mail        : shipuahamed01@gmail.com/*--------------------------------------------*/ #include<stdio.h>int main(){    int v,t;    while(scanf("%d %d",&v,&t)==2)    {        if(v==0 && t==0)        printf("0n");        else        printf("%dn",2*v*t);    }    return 0;}...

Uva 12545 – Bits Equalizer

Problem Link Solution :- Bits Equalizer C++ /*------------------------------------------------*/ //Uva Problem No: 12545 //Problem Name : Bits Equalizer //Type : String //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 n,no=0; char s[10000],t[10000],temp; sc("%d",&n); while(n--) { sc("%s%s",s,t); int l1=strlen(s); int l2=strlen(t); if(l1>l2||l1<l2) { pf("Case %d: -1n",++no); continue; } int ws=0,wt=0,zs=0,zt=0,os=0,ot=0,c=0,d=0; for(int i=0;i<l1;i++) { if(s[i]=='?') ws++; if(s[i]=='0') c++; if(s[i]=='1') d++; if(s[i]=='0'&&t[i]=='1') zs++; if(s[i]=='1'&&t[i]=='0') os++; if(t[i]=='0') zt++; if(t[i]=='1') ot++; } if(d>ot) { pf("Case %d: -1n",++no); } else { pf("Case %d: %dn",++no,zs+os-min(zs,os)+ws); } } return 0; } 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 /*------------------------------------------------*///Uva Problem No: 12545//Problem Name  : Bits Equalizer//Type          : String//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 n,no=0;    char s[10000],t[10000],temp;    sc("%d",&n);    while(n--)    {        sc("%s%s",s,t);        int l1=strlen(s);        int l2=strlen(t);        if(l1>l2||l1<l2)        {            pf("Case %d: -1n",++no);            continue;        }        int ws=0,wt=0,zs=0,zt=0,os=0,ot=0,c=0,d=0;        for(int i=0;i<l1;i++)        {            if(s[i]=='?')            ws++;            if(s[i]=='0')            c++;            if(s[i]=='1')            d++;            if(s[i]=='0'&&t[i]=='1')            zs++;            if(s[i]=='1'&&t[i]=='0')            os++;            if(t[i]=='0')            zt++;            if(t[i]=='1')            ot++;        }        if(d>ot)        {           pf("Case %d: -1n",++no);        }        else        {          pf("Case %d: %dn",++no,zs+os-min(zs,os)+ws);        }    }    return 0;}...

Uva 10420 – List of Conquests

Problem Link Solution :- Uva 10420 - List of Conquests C++ /*------------------------------------------------*/ //Problem Setter: Thomas Tang, Queens University //Uva Problem No: 10420 //Problem Name : List of Conquests //Type : Ad hoc,Sorting //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 n; vector<string>v; map<string,int>mp; string s,a; cin>>n; getchar(); while(n--) { cin>>s; getchar(); getline(cin,a); if(mp[s]) { mp[s]++; } else { mp[s]++; v.push_back(s); } } sort(v.begin(),v.end()); for(int i=0;i<v.size();i++){ string c=v[i]; cout<<""<<c<<" "<<mp[c]<<endl; } v.clear(); return 0; } 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 /*------------------------------------------------*///Problem Setter: Thomas Tang, Queens University//Uva Problem No: 10420//Problem Name  : List of Conquests//Type          : Ad hoc,Sorting//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 n;    vector<string>v;    map<string,int>mp;    string s,a;    cin>>n;    getchar();    while(n--)    {        cin>>s;        getchar();        getline(cin,a);        if(mp[s])        {           mp[s]++;        }        else        {         mp[s]++;         v.push_back(s);        }    }    sort(v.begin(),v.end());    for(int i=0;i<v.size();i++){    string c=v[i];    cout<<""<<c<<" "<<mp[c]<<endl;    }    v.clear();     return 0;}...

Uva 10494 – If We Were a Child Again

Problem Link Solution :- If We Were a Child Again C++ /*------------------------------------------------*/ //Problem Setter: S. M. Ashraful Kadir //Uva Problem No: 10494 //Problem Name : If We Were a Child Again //Type : Bignum, Division. //Author : Shipu Ahamed //University : BUBT //E-mail : shipuahamed01@gmail.com /*--------------------------------------------*/ #include<cstdio> #include<cstring> #include<string> #include<cmath> #include<cctype> #include<map> #include<stack> #include<cstdlib> #include <queue> #include <vector> #include<algorithm> #include<iostream> #define ll long long #define sc scanf #define pf printf #define Pi 2*acos(0.0) using namespace std; char res[100000]; void dev(char s[],long long int n) { long long int rem=0,i,j=0; char a[100000]; int f=1; for(i=0;i<strlen(s);i++) { rem=s[i]-'0'+rem*10; if(rem/n!=0) f=0; if(!f) printf("%lld",rem/n); rem=rem%n; } if(f) printf("0"); } int rem(char s[],long long int n) { long long int i,rem=0,j; for(i=0;i<strlen(s);i++) { rem=s[i]-'0'+rem*10; rem=rem%n; } return rem; } int main() { char s[100000],t;; long long int i,j,k,l,m,n; while(scanf("%s %c %lld",&s,&t,&n)==3) { if(t=='/') { dev(s,n); printf("n"); } else { m=rem(s,n); printf("%lldn",m); } } return 0; } 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 /*------------------------------------------------*///Problem Setter: S. M. Ashraful Kadir//Uva Problem No: 10494//Problem Name  : If We Were a Child Again//Type          : Bignum, Division.//Author        : Shipu Ahamed//University    : BUBT//E-mail        : shipuahamed01@gmail.com/*--------------------------------------------*/ #include<cstdio>#include<cstring>#include<string>#include<cmath>#include<cctype>#include<map>#include<stack>#include<cstdlib>#include <queue>#include <vector>#include<algorithm>#include<iostream>#define ll long long#define sc scanf#define pf printf#define Pi 2*acos(0.0)using namespace std;char res[100000]; void dev(char s[],long long int n){    long long int rem=0,i,j=0;    char a[100000];    int f=1;    for(i=0;i<strlen(s);i++)    {        rem=s[i]-'0'+rem*10;        if(rem/n!=0)        f=0;        if(!f)        printf("%lld",rem/n);        rem=rem%n;    }    if(f)    printf("0");} int rem(char s[],long long int n){   long long  int i,rem=0,j;    for(i=0;i<strlen(s);i++)    {        rem=s[i]-'0'+rem*10;        rem=rem%n;    }    return rem;}int main(){    char s[100000],t;;    long long int i,j,k,l,m,n;    while(scanf("%s %c %lld",&s,&t,&n)==3)    {        if(t=='/')        {            dev(s,n);            printf("n");        }         else        {            m=rem(s,n);            printf("%lldn",m);        }    }    return 0;}...