Задача A автор Грубіян Євген
#include <iostream>
using namespace std;
int main()
{
int booms=0;
int h1,m1,h2,m2;
cin >> h1 >> m1 >> h2 >> m2;
int t1=h1*60 +m1;
int t2=h2*60 +m2;
for (int i=t1; i<=t2; i++)
{
if (i==0) booms+=12;
if (i%60 == 0)
{
booms+=i/60;
if (i/60 > 12)
{
booms-=12;
}
}
if (i%60==30) booms++;
}
cout<<booms;
return 0;
}
Задача B автор Глембоцький Владислав
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <stack>
#include <cmath>
#include <map>
#include <stack>
#include <set>
#include <iomanip>
#include <queue>
#include <map>
#include <functional>
#include <memory.h>
#include <list>
#include <ctime>
using namespace std;
const long long inf = 1e9+7;
const long long mod = 1e9+7;
const double eps = 1e-9;
const double PI = 2*acos(0.0);
const double E = 2.71828;
typedef long long ll ;
typedef double ld ;
inline double S(double x, double y, double z) {
double p = (x+y+z) / 2.0 ;
return sqrt( p * (p - x) * (p - y) * (p - z) ) ;
}
ll a[111111] ;
int main(void) {
freopen("z2.dat","rt",stdin);
freopen("z2.sol","wt",stdout);
ll n ;
cin >> n ;
for(int i=0;i<n;i++) {
cin >> a[i] ;
}
sort(a,a+n) ;
reverse(a,a+n) ;
double Max = 0 ; ll A,B,C ;
for(int i=0;i<n-2;i++) {
if(S(a[i],a[i+1],a[i+2]) > Max)
Max = S(a[i],a[i+1],a[i+2]) , A = a[i] , B = a[i+1] , C = a[i+2] ;
}
if(Max != 0) cout << setprecision(3) << fixed << Max << " " ; else cout << 0 << endl , exit(0) ;
cout << A << " " << B << " " << C << endl ;
return 0 ;
}
Задача C автор Сорока Дмитро
var a:Array[0..50,0..50]of integer;
n,m,k,i,j,x,y,xx,yy,d:integer;
function ok(x1,y1:integer):Boolean;
begin
ok:=False;
if x1<1 then Exit;
if y1<1 then Exit;
if x1>n then Exit;
if y1>m then Exit;
if a[y1,x1]<>1 then Exit;
if d>=Abs(x1-x)+abs(y1-y) then
begin
ok:=True;
d:=Abs(x1-x)+abs(y1-y);
end;
end;
procedure INT;
begin
read(n,m,k);
for i:=n downto 1 do
for j:=1 to m do
begin
read(a[i,j]);
if a[i,j]=2 then begin y:=i;x:=j;a[i,j]:=1; end;
if a[i,j]=3 then begin yy:=i;xx:=j;a[i,j]:=1; end;
end;
end;
begin
Assign(input,'z3.dat');Reset(input);
Assign(output,'z3.sol');Rewrite(output);
INT;
for i:=1 to k-1 do
begin
read(x,y);
d:=Abs(xx-x)+abs(yy-y);
for j:=1 to 2 do
if ok(xx,yy+1) then inc(yy) else
if ok(xx,yy-1) then dec(yy) else
if ok(xx+1,yy) then inc(xx) else
if ok(xx-1,yy) then dec(xx);
if d=0 then begin Writeln('DIGIT');write(xx,' ',yy);Exit; end;
end;
read(x,y);
if (x=xx)and(y=yy) then
begin Writeln('DIGIT');write(xx,' ',yy);Exit; end;
writeln('CPU');
write(xx,' ',yy);
Close(input);
Close(Output);
end.