Exemple #1
0
int main()
{
int t;
unsigned long long int x,y,z;
scanf("%d",&t);
while(t--)
{

scanf("%llu",&x);
scanf("%llu",&y);
z=x+y;
x=removes(x);
y=removes(y);

if(x+y==removes(z))
{
printf("YES\n");
}
else
{
printf("NO\n");
}
}
return 0;
}
Exemple #2
0
int main()
{
    int item,front,rear,ch,q[queue],deleted,count;
    front=0;
    rear=-1;
    count=0;
    while(1)
    {
        printf("\n1.add\n2.display\n3.delete\n");
        scanf("%d",&ch);
        switch(ch)
        {
            case 1:printf("\n nenter element to enter\n");
            scanf("%d",&item);
            add(item,&rear,q,&count);
            break;
            case 2:display(front,q,count);
            break;
            case 3:deleted=removes(&front,q,&count);
            if(deleted==-1)
            {
                printf("\n queue empty");
            }
else
                   printf("\n item deleted is %d",deleted);
                   break;
                   default:exit(0);
        }
    }
   
    return 0;
}
bool CharCreationManager::LoadLifeEvents()
{
    Result events(db->Select("SELECT * from char_create_life"));

    if(!events.IsValid() || events.Count() == 0)
        return false;

    for(unsigned int x = 0; x < events.Count(); x++)
    {
        LifeEventChoiceServer* choice = new LifeEventChoiceServer;
        choice->id = events[x].GetInt(0);
        choice->name = events[x][1];
        choice->description = events[x][2];
        choice->cpCost = events[x].GetInt(3);
        choice->eventScript = events[x][4];

        csString common = events[x][5];
        choice->common = common.GetAt(0);

        Result adds(db->Select("SELECT adds_choice from char_create_life_relations WHERE adds_choice IS NOT NULL AND choice=%d", choice->id));
        if(!adds.IsValid())
        {
            delete choice;
            return false;
        }

        for(unsigned int addIndex = 0; addIndex < adds.Count(); addIndex++)
        {
            choice->adds.Push(adds[addIndex].GetInt(0));
        }

        Result removes(db->Select("SELECT removes_choice from char_create_life_relations WHERE removes_choice IS NOT NULL AND choice=%d", choice->id));
        if(!removes.IsValid())
        {
            delete choice;
            return false;
        }

        for(unsigned int removesIndex = 0; removesIndex < removes.Count(); removesIndex++)
        {
            choice->removes.Push(removes[removesIndex].GetInt(0));
        }

        lifeEvents.Push(choice);
    }

    return true;
}
Exemple #4
0
void process(){
    switch(comingbuf[0])
    {
        case '0' : search();
            break;
        case '1' : searchUS();
            break;
        case '2' : login();
            break;
        case '3' : regsiter();
            break;
        case '4' : adds();
            break;
        case '5' : removes();
            break;
        case '6' : logout();
            break;
        default : break;
    }
}