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

Продавница#

C++#

//v10
#include <iostream>
 
using namespace std;
 
int main()
{
    int n,m,a=0,b,c;
    cin>>n>>m;
    c=m-n;
    a+=c/5;
    c-=(c/5)*5;
    a+=c/2;
    c-=(c/2)*2;
    a+=c;
    cout<<a<<endl;
    return 0;
}

Броеви#

C++#

//v10
#include <iostream>
 
using namespace std;
 
int main()
{
    int n,m,a,b;
    cin>>n>>m;
    a=(n+m)/2;
    b=n-a;
    if(a>=0&&b>=0&&(n+m)%2==0)cout<<a<<" "<<b<<endl;
    else cout<<"NE MOZE"<<endl;
}

Бројот 9#

C++#

//v10
#include <iostream>
 
using namespace std;
 
int main()
{
    int n,m,a=0,b,c;
    long long sum=0;
    string ab;
    cin>>ab;
    for(int i=0;i<ab.size();i++)sum+=ab[i]-48;//-48 za da go konvertiras od ASCII u dekaden
    if(sum%9==0)cout<<'0'<<endl;
    else if(sum%3==0)cout<<'2'<<endl;//ako e deliv so 3 a ne so 9 treba da se dodade istiot broj uste 2 pati.
    else cout<<'8'<<endl;//ako ne e deliv nitu so 9 nitu so 3 togas e zaemno prost so 9 pa treba da se sobere uste 8 pati.
}

Мечето ушко#

C++#

    //Филип Бујаровски
    #include <iostream>  
    #include <cstring>  
    #include <cmath>  
    #include <math.h>  
    using namespace std;  
      
    int main()  
    {  
        int i,j,n,k;  
        cin>>n;  
        int niza[n];  
        int zbir=0;  
        for(i=0;i<n;i++)  
        {  
              cin>>niza[i];  
              zbir+=niza[i];  
        }  
        int x;  
        bool c[(zbir)+1];  
        memset(c,false,sizeof(c));  
        c[0]=true;  
        for(i=0;i<n;i++)  
        {  
              k=niza[i];  
              for(j=zbir;j>=0;j--)  
              {  
                    x=j+k;  
                    if(c[j]==true)  
                    {  
                          if(j+k<zbir)  
                          c[j+k]=true;  
                    }  
              }  
        }  
      
        int p=0,q=0;  
          for(i=zbir/2;i>=0;i--)  
          {  
                if(c[i]==true)  
                {  
                      p=i;  
                      break;  
                }  
          }  
          q=zbir-p;  
          cout<<fabs(p-q)><<endl;  
      
      
        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 v10.