Submission #80894


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
int main(){
int a1,a2,b1,b2,ans=0;
cin>>a1>>a2>>b1>>b2;
int q,p;
q=a1*60+a2;
p=b1*60+b2;
int x[4];
int y[4];
x[0]=q/60/10;
x[1]=q/60-q/60/10*10;
x[2]=(q-q/60*60)/10;
x[3]=(q-q/60*60)-(q-q/60*60)/10*10;
//cout<<x[0]<<x[1]<<x[2]<<x[3]<<" ";
y[0]=p/60/10;
y[1]=p/60-p/60/10*10;
y[2]=(p-p/60*60)/10;
y[3]=(p-p/60*60)-(p-p/60*60)/10*10;
//cout<<y[0]<<y[1]<<y[2]<<y[3]<<" ";
int z[4];
z[0]=x[0];
z[1]=x[1];
z[2]=x[2];
z[3]=x[3];
for(;q!=p;){
q++;
x[0]=q/60/10;
x[1]=q/60-q/60/10*10;
x[2]=(q-q/60*60)/10;
x[3]=(q-q/60*60)-(q-q/60*60)/10*10;
//cout<<x[0]<<x[1]<<x[2]<<x[3]<<" ";
for(int i=0;i<4;i++){
if(z[i]!=x[i]){
if(x[i]==0){
if(i==1||i==3){
ans+=1;
}else if(i==2||i==0){
ans+=2;
}
}else if(x[i]==3||x[i]==4||x[i]==6||x[i]==7){
ans+=1;
}else if(x[i]==1||x[i]==9){
ans+=0;
}else if(x[i]==2){
ans+=4;
}else if(x[i]==5){
ans+=2;
}else {
ans+=3;
}
z[i]=x[i];
}
}
}
cout<<ans<<endl;
}

ステータス

項目 データ
問題 1538 - デジタル時計
ユーザー名 r2422
投稿日時 2024-09-04 16:11:26
言語 C++17
状態 Accepted
得点 10
ソースコード長 1557 Byte
最大実行時間 26 ms
最大メモリ使用量 604 KB

セット

セット 得点 Cases
1 ALL 10 / 10 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in1 AC 19 ms 604 KB
1
in2 AC 24 ms 576 KB
1
in3 AC 19 ms 548 KB
1
in4 AC 18 ms 524 KB
1
in5 AC 23 ms 492 KB
1
in6 AC 26 ms 468 KB
1
in7 AC 18 ms 564 KB
1
in8 AC 20 ms 532 KB
1