program ThoiGian;
var
v, h, i, j : byte;
d, n : array [1 .. 10] of byte;
t : array [0 .. 23, 0 .. 59, 1 .. 2] of byte;
procedure setup;
begin
{ d = 4, 2, 2, 2, 3, 2, 3, 2, 4, 3 }
{ n = 2, 0, 3, 3, 1, 3, 3, 1, 3, 3 }
d[1]:=4; n[1]:=2;
d[2]:=2; n[2]:=0;
d[3]:=2; n[3]:=3;
d[4]:=2; n[4]:=3;
d[5]:=3; n[5]:=1;
d[6]:=2; n[6]:=3;
d[7]:=3; n[7]:=3;
d[9]:=2; n[8]:=1;
d[9]:=4; n[9]:=3;
d[10]:=3; n[10]:=3;
end;
function dung(x: byte; i: byte): byte;
begin
if i = 2 then
dung := (d[x div 10 + 1] + d[x mod 10 + 1])
else
dung := d[x + 1];
end;
function ngang(x: byte; i: byte): byte;
begin
if i = 2 then
ngang := (n[x div 10 + 1] + n[x mod 10 + 1])
else
ngang := n[x + 1];
end;
begin
read(v, h);
setup;
for i:=0 to 23 do
for j:=0 to 59 do
begin
if i > 9 then
begin
t[i][j][1] := dung(i, 2) + dung(j, 2);
t[i][j][2] := ngang(i, 2) + ngang(j, 2);
end
else
begin
t[i][j][1] := dung(i, 1) + dung(j, 2);
t[i][j][2] := ngang(i, 1) + ngang(j, 2);
end
end;
for i:=0 to 23 do
for j:=0 to 59 do
if (t[i][j][1] = v) and (t[i][j][2] = h) then
begin
write(i);
if (j <= 9) then writeln(':0', j)
else writeln(':', j);
exit;
end;
end.
#include <bits/stdc++.h>
using namespace std;
int d[10]= {4,2,2,2,3,2,3,2,4,3};
int n[10]= {2,0,3,3,1,3,3,1,3,3};
int v,h;
int so_gach_ngang(int x, int y)
{
int s=0;
if (x<10) s = s+n[x];
else s = s+n[x%10]+n[x/10];
if (y<10) s = s+n[0]+n[y];
else s = s+n[y%10]+n[y/10];
return s;
}
int so_gach_dung(int x,int y)
{
int s=0;
if (x<10) s = s+d[x];
else s = s+d[x%10]+d[x/10];
if (y<10) s = s+d[0]+d[y];
else s = s+d[y%10]+d[y/10];
return s;
}
void xuat(int x, int y)
{
cout<<x<<":";
if (y<10) cout<<"0";
cout<<y;
}
void giai()
{
for (int i=0;i<=23;i++)
{
for (int j=0;j<=59;j++)
{
if ((so_gach_dung(i,j)==v)&&(so_gach_ngang(i,j)==h))
{
xuat(i,j);
return;
}
}
}
return;
}
int main()
{
//freopen("thoigian.inp","r",stdin);
//freopen("thoigian.out","w",stdout);
cin>>v>>h;
giai();
}
//ProDev
// so_gach_dung với so_gach_ngang trong pascal là function bạn nhé, giai là procedure, còn int là longint nha
Tin học, tiếng Anh: informatics, tiếng Pháp: informatique, là một ngành khoa học chuyên nghiên cứu quá trình tự động hóa việc tổ chức, lưu trữ, xử lý và truyền dẫn thông tin của một hệ thống máy tính cụ thể hoặc trừu tượng (ảo). Với cách hiểu hiện nay, tin học bao hàm tất cả các nghiên cứu và kỹ thuật có liên quan đến việc mô phỏng, biến đổi và tái tạo thông tin.
Nguồn : Wikipedia - Bách khoa toàn thưLớp 8 - Năm thứ ba ở cấp trung học cơ sở, học tập bắt đầu nặng dần, sang năm lại là năm cuối cấp áp lực lớn dần nhưng các em vẫn phải chú ý sức khỏe nhé!
Nguồn : ADMIN :))Xem thêm tại https://loigiaisgk.com/cau-hoi or https://giaibtsgk.com/cau-hoi
Copyright © 2021 HOCTAPSGK