Регионален Натпревар 2013#
Монети#
C++#
//Ѓорче
#include <iostream>
using namespace std;
int main()
{
int a[4];
cin>>a[0]>>a[1]>>a[2]>>a[3];
int zero = 0, five = 0;
for (int i=0; i<4; i++)
{
if (a[i] == 0)
zero++;
else
five++;
}
if (zero >= five)
cout<<five<<endl;
else
cout<<zero<<endl;
//system("pause");
return 0;
}
Уписи#
C++#
//Ѓорче
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int N;
cin >>N;
vector<int> kand(N);
for (int i=0; i<N; i++)
{
int a, b;
cin>>a>>b;
kand[i] = a*60 + b;
}
int sum = 1;
for (int i=0; i<N-1; i++)
{
int temp = 1;
for (int j=i+1; j<N; j++)
{
if (kand[i] == kand[j])
temp++;
else
break;
}
if (temp > sum)
sum = temp;
}
cout<<sum<<endl;
//system("pause");
return 0;
}
Цифри#
C++#
//Ѓорче
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin>>a>>b;
int num[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
for (int i=a; i<=b; i++)
{
for (int j=1; j<=i; j*=10)
{
int r = (i/j)%10;
num[r]++;
}
}
for (int i=0; i<10; i++)
cout<<num[i]<<" ";
cout<<endl;
//system("pause");
return 0;
}
Испит#
C++#
//Ѓорче
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin>>a>>b;
int sum;
if (a == b)
sum = a*2-2;
else if (a < b)
sum = a*2 - 1;
else
sum = b*2 - 2;
cout<<sum<<endl;
//system("pause");
return 0;
}
Седумка#
C++#
//Ѓорче
#include <iostream>
using namespace std;
int main()
{
long long broj;
int k;
cin>>broj>>k;
long long x=1;
for (long long i=broj+1; i>0; i+=x)
{
int sum=0;
for (long long y=1; y<=i; y*=10)
{
if ((i/y)%10 == 7)
sum++;
}
if ((i/x) % 10 ==7)
x*=10;
if (sum >= k)
{
cout<<i<<endl;
break;
}
}
//system("pause");
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 |
|---|---|---|---|---|---|---|
cbp |
Инженер.cbp | 1.1 kB | 1 | 20-Aug-2015 17:35 | lameski |
«
This particular version was published on 20-Aug-2015 17:35 by Ѓорче.
G’day (anonymous guest)
Log in
JSPWiki v2.8.3