Stay up Late and Wake up Early(模拟)
思路:简单模拟的水题,注意可能不是同一天取下模即可。
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
#define mst(a) memset(a,0,sizeof a)
bool jg(int x){
int h=x/60,m=x%60;
if(h%10==7||m%10==7) return 1;
return 0;
}
int main(){
int t;
cin>>t;
while(t--){
int x,h,m;
char c;
cin>>x>>h>>c>>m;
int tot=h*60+m,cnt=0;
while(!jg(tot)){
tot=(tot-x+1440)%1440;
cnt++;
}
printf("%d %02d:%02d\n",cnt,tot/60,tot%60);
}
return 0;
}