This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

Продавница#

C++#

#include <iostream>
using namespace std;
int main()
{
    int p,v;
    cin>>p>>v;
    int kusur=v-p, i=0;
    while(kusur>0)
    {
        if(kusur>=5)
        {
            kusur-=5;
            i++;
        }
        else if(kusur>=2)
        {
            kusur-=2;
            i++;
        }
        else if(kusur>=1)
        {
            kusur-=1;
            i++;
        }
    }
    cout<<i;
    return 0;
}

Броеви#

C++#

#include <iostream>
using namespace std;
int main()
{
    int z,r;
    cin>>z>>r;
    int x,y;
    y=(z+r)/2;
    x=z-y;
    int p1,p2;
    if(x>y)
    {
        p1=x;
        p2=y;
    }
    else
    {
        p1=y;
        p2=x;
    }
    if(y<0 || x<0 || r!=p1-p2 || z!=p1+p2)
    {
        cout<<"NE MOZE";
    }
    else
    {
        cout<<p1<<" "<<p2;
    }
    return 0;
}

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
cpp
main.cpp 0.3 kB 4 20-Aug-2015 17:35 metotra Инженер, регионален 2013, напредна група
« This particular version was published on 20-Aug-2015 17:35 by mariomako.