Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. int x,h,m;
  5. void goback(){
  6.     if(m==0 & h==0){
  7.         h=23;
  8.         m=59;}
  9.     else if(m==0){
  10.         h--;
  11.         m=59;
  12.     }
  13.     else
  14.         m--;
  15. }
  16. bool check(int m,int h){
  17.     bool test = false;
  18.     int c;
  19.     while(m!=0){
  20.         c = m % 10;
  21.         m = m / 10;
  22.         if(c==7){
  23.             return true;
  24.             break;
  25.         }
  26.     }
  27.     while(h!=0){
  28.         c = h % 10;
  29.         h = h / 10;
  30.         if(c==7){
  31.             return true;
  32.             break;
  33.         }
  34.     }
  35.     return test;
  36. }
  37. int main(){
  38.  
  39.  
  40.     cin>>x;
  41.     cin>>h;
  42.     cin>>m;
  43.     int total=0;
  44.     while(check(m,h)==false){
  45.     goback();
  46.     total++;
  47.     }
  48.     int y = total/x;
  49.     cout<<y;;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement