【Codeforces Round #457 (Div. 2) A】 Jamie and Alarm Snooze
阿新 • • 發佈:2018-01-20
als lar clu efi out .com bit source fin
【鏈接】 我是鏈接,點我呀:)
【題意】
在這裏輸入題意
【題解】
暴力往前走x分鐘就好。
直到出現7為止。
【代碼】
#include <bits/stdc++.h>
using namespace std;
int hh,mm,x,cnt;
bool find7(){
if (hh%10==7 || (hh/10)==7) return true;
if (mm%10==7 || (mm/10)==7) return true;
return false;
}
int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt" , "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
cin >> x;
cin >> hh >> mm;
while (!find7()){
mm-=x;
cnt++;
if (mm<0){
hh--;
mm+=60;
if (hh<0){
hh = 23;
}
}
}
cout <<cnt<<endl;
return 0;
}
【Codeforces Round #457 (Div. 2) A】 Jamie and Alarm Snooze