Channels

Link: https://ac.nowcoder.com/acm/contest/11424/C
Source: Niuke

Title description
Nancy likes to study and watch TV.
In order to know how long she can watch a program, let’s suppose that the program starts at time 1 and continues to time 6 \times 10^{100}6×10
100
. Each program lasts 50 moments, and there will be 10 moments of advertising time between the program and the program.
However, Nancy is really busy, she from t_1t
1 start viewing time watching to t_2t 2 moment, please help calculate how much time she can enjoy TV programs. Input Description: The number of lines: two integers each row t_1t . 1 and t_2t 2 . Data satisfies:. 1 \ Leq T_l \ Leq T_2 \ Leq 18 is 10 ^ {} 1 ≦ T . 1 ≦ T 2 ≦ 10 18 is . Output description: Several lines: an integer in each line, indicating the number of times when you can taste the TV program. Example 1 Input Copy 1 61 Output Copy 51 Example 2
































Input
Copy
116969978 507978500
180480072 791550396
139567120 655243745
1470545 167613747
57644034 176077476
44676 56984808
215706822 369042088
108368065 320914746
Output
Copy
325840433
509225275
429730516
138452673
98694536
47450113
127779387
177122232

Because the title says to start counting from 1, but there are many boundary problems in this way, we first reduce all by 1, so that it is discrete to start counting from 0, and then 1----59 is a group, and so on

#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <stack>
#include <map>
#include <unordered_map>
#include <vector>
#include <cmath>
#include <ext/rope>
#include <bits/stdc++.h> 

using namespace std;

#define gt(x) x = read()
#define int long long
#define ios ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);

const int mod = 1e9 + 7;
const int PP = 131;

inline int read(int out = 0)
{
    
    
    char c;
    while((c=getchar()) < 48 || c > 57);
    while(c >= 48 && c <= 57) out=out*10+c-48,c=getchar();
    return out; 
}

const int N = 1e5 + 10;
const int M = 1e6 + 10;

signed main(){
    
    
	int t1, t2;
	while(~scanf("%lld%lld", &t1, &t2)){
    
    
        t1 --;
        t2 --;
			int ans = 0;
	int temp = t1 % 60;
//	cout << temp << endl;
	temp = (60 - temp);
//	cout << temp << endl;
	if (temp >= 10){
    
    
		ans += (temp - 10);
	}
//	cout << ans << endl;
	t1 += temp;
	//cout << t1 << endl;
	temp = (t2 % 60);
	//cout << temp << endl;
	if (temp >= 49)  ans += 50;
	else    ans += temp + 1;
	//cout << ans << endl;
	t2 -= temp;
//	cout << t2 << endl;
	temp = (t2 - t1) / 60;
	//cout << temp << endl;
	ans += (temp * 50);
//	cout << ans << endl;
	
	cout << ans  << endl;	
	}
	
	return 0;
}

Guess you like

Origin blog.csdn.net/qq_45772483/article/details/112718957