2 solutions
-
0
分类讨论情况
#include<bits/stdc++.h> using namespace std; char time1[100005]; int main() { std::ios::sync_with_stdio(false); int a=0,b=0,c=0,d=0; cin>>time1; d=time1[strlen(time1)-1]-'0'; if(time1[1]!=':'){ a=time1[0]-'0'; b=time1[1]-'0'; if(time1[4]!='\0') c=time1[3]-'0'; } else{ b=time1[0]-'0'; if(time1[3]!='\0') c=time1[2]-'0'; } if(b>=6||(b==5&&c*10+d>b*10+a)) { if(a==0) cout<<(10-b)*60-c*10-d+1; else cout<<(20-a*10-b)*60-c*10-d+2; }else if(a==2&&b==3&&c*10+d>b*10+a) cout<<60-c*10-d; else{ if(c*10+d<b*10+a) cout<<b*10+a-c*10-d; else if(c*10+d==b*10+a) cout<<0; else cout<<60+(b+1)*10+a-c*10-d; } return 0; }
Information
- ID
- 6464
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 2
- Tags
- # Submissions
- 651
- Accepted
- 129
- Uploaded By