MY name is ruhul amin

ISLAMIC UNIVERSITY OF KUSHTIA

Sunday, May 12, 2013

codeforces contest program

#include <iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<queue>
using namespace std;
class name
{
    int p;
    int q,m;
    int r,c;
    public:
    void member(int n);
};
void name::member(int n)
{
    c=0;
    for(int i=1;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            r=i*i+j*j;
            p=int(sqrt(i*i+j*j));
            q=p*p;
            if(r>n*n)
            break;
            if(r==q)
            {
            c=c+1;
            }
        }
    }
    cout<<c<<endl;
}
int main()
{
    int a;
    name ob;
    while(cin>>a)
    {
        ob.member(a);
    }
    return 0;
}

Thursday, May 2, 2013

sort using class of c++ program

#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
class node
{
    public:
    string name;
    int age;
    int roll;
    float marks;
};
bool com(const node as,const node k)
{
    if(as.name<k.name)
    return true;
    if((as.name<k.name)||(as.age<k.age))
    return true;
    if(as.marks>k.marks)
    return true;
}
int main()
{
    int n;
    string s;
    int a;
    int r;
    double m;
    node g;
    while(cin>>n)
    {
        vector<node>v;
        for(int i=0;i<n;i++)
        {
        cin>>s;
        cin>>a;
        cin>>r;
        cin>>m;
        g={s,a,r,m};
        v.push_back(g);
        }
    sort(v.begin(),v.end(),com);
    for(int i=0;i<v.size();i++)
    cout<<v[i].name<<" "<<v[i].age<<" "<<v[i].roll<<" "<<v[i].marks<<endl;
    }
    return 0;
}