NC201606. Channels
描述
输入描述
若干行:每行两个整数与
。
数据满足:。
输出描述
若干行:每行一个整数,表示能品味电视节目的时刻数。
示例1
输入:
1 61
输出:
51
示例2
输入:
116969978 507978500 180480072 791550396 139567120 655243745 1470545 167613747 57644034 176077476 44676 56984808 215706822 369042088 108368065 320914746
输出:
325840433 509225275 429730516 138452673 98694536 47450113 127779387 177122232
pypy3(pypy3.6.1) 解法, 执行用时: 305ms, 内存消耗: 25936K, 提交时间: 2020-01-18 19:36:17
def calc(x): ans = x // 60 * 50 return min(x % 60, 50) + ans try: while True: t1, t2 = map(int, input().split()) print(calc(t2) - calc(t1 - 1)) except EOFError: pass
C++14(g++5.4) 解法, 执行用时: 46ms, 内存消耗: 792K, 提交时间: 2020-01-20 10:48:35
#include <bits/stdc++.h> using namespace std; #define ll long long int main(){ ll a,b; while(cin>>a>>b){ a-=1; cout<<b/60*50+min(50*1LL,b%60)-a/60*50-min(50*1LL,a%60)<<endl; } return 0; }
C(clang11) 解法, 执行用时: 10ms, 内存消耗: 708K, 提交时间: 2020-12-31 12:48:51
#include<stdio.h> #define min(a,b) (a<b ? a:b) long long L,R; int main() { while(~scanf("%lld%lld",&L,&R)) printf("%lld\n",R/60*50+min(R%60,50)-((L-1)/60*50+min((L-1)%60,50))); }
C++11(clang++ 3.9) 解法, 执行用时: 41ms, 内存消耗: 812K, 提交时间: 2020-01-24 00:20:34
#include<bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ll a,b; while(cin>>a>>b) cout<<b/60*50+min(50ll,b%60)-(a-1)/60*50-min(50ll,(a-1)%60)<<'\n'; }
Python3(3.5.2) 解法, 执行用时: 184ms, 内存消耗: 4600K, 提交时间: 2020-02-01 20:58:49
while True: try: t1, t2 = map(int, input().split()) b = (t1-1)//60*50+min((t1-1)%60,50) a = t2//60*50+min(t2%60,50) print(a-b) except Exception: break