665A - Buses Between Cities - CodeForces Solution


implementation *1600

Please click on ads to support us..

C++ Code:

#include<bits/stdc++.h>
#define int long long 
#define rep(i,x,y) for(int i=x;i<=y;i++)
#define pre(i,x,y) for(int i=x;i>=y;i--)
using namespace std;
const int N=2e5+10,INF=0x3f3f3f3f,mod=1e9+7;

inline int read() {
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')f=((ch=='-')?-1:f),ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}


void solve(){
	int a=read(),ta=read();
	int b=read(),tb=read();
	int h,m;
	scanf("%lld:%lld",&h,&m);
	int t1=h*60+m,t2=t1+ta;
	//cout<<t1-tb<<" "<<t2<<endl;
	int bt=5*60;
	int ans=0;
	for(int i=bt;i<=23*60+59;i+=b){
		//cout<<i<<endl;
		if(t1-tb<i&&i<t2)ans++;
	}
	cout<<ans;
	
}

signed main(){ 
	int T=1;
	//T=read();
	while(T--)solve();
    return 0;
}
/*
10 30
10 35
05:35 


*/

 					    		 	 		 	   		 	 				


Comments

Submit
0 Comments
More Questions

1633C - Kill the Monster
1611A - Make Even
1030B - Vasya and Cornfield
1631A - Min Max Swap
1296B - Food Buying
133A - HQ9+
1650D - Twist the Permutation
1209A - Paint the Numbers
1234A - Equalize Prices Again
1613A - Long Comparison
1624B - Make AP
660B - Seating On Bus
405A - Gravity Flip
499B - Lecture
709A - Juicer
1358C - Celex Update
1466B - Last minute enhancements
450B - Jzzhu and Sequences
1582C - Grandma Capa Knits a Scarf
492A - Vanya and Cubes
217A - Ice Skating
270A - Fancy Fence
181A - Series of Crimes
1638A - Reverse
1654C - Alice and the Cake
369A - Valera and Plates
1626A - Equidistant Letters
977D - Divide by three multiply by two
1654B - Prefix Removals
1654A - Maximum Cake Tastiness