CODECHEF(比赛)——TSEC January Codeathon

最终成绩: 300/600第一题The Speed LimitAll submissions for this problem are available.Chef is travelling to the nearest cricket stadium to watch his favourite team play. Unfortunately for him, he is runnin...
摘要由CSDN通过智能技术生成

最终成绩: 300/600

第一题
The Speed Limit

All submissions for this problem are available.Chef is travelling to the nearest cricket stadium to watch his favourite team play. Unfortunately for him, he is running late. The road to the stadium has a speed limit L km/h. If Chef is D kms away from the stadium, find whether he can reach the stadium in H hours, if he cannot travel faster than the speed limit.

Input:
First line of input contains the number of test cases T. Then the test cases follow.
Each test case consists of three space separated integers L, D and H denoting the speed limit in km/h, the distance and the number of hours in which Chef has to reach the stadium.
Output:
For each test case, output in a single line, the word ‘Yes’ if Chef can reach on time, and the word ‘No’ if he cannot.
Constraints:
1≤T≤5
1≤L≤300
1≤D≤7000
1≤H≤24
Sample Input:
2
100 250 2
72 123 3
Sample Output:
No
Yes

题目大意:

已知时间,速度,求是否能赶上棒球比赛。

题目解析:

超级签到题。

具体代码:
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
   
    int t,l,d,h;
    cin>>t;
    while(t--){
   
    	cin>>l>>d>>h;
    	if(l*h>=d)
    		cout<<"Yes"<<endl;
    	else
    		cout<<"No"<<endl;
	}
    return 0;
}
第二题
The Prime Count

All submissions for this problem are available.Consider a generalized form of Fibonacci sequence where the first two terms are defined arbitrarily. Your task is to find total number of primes in the first 20 terms of the sequence, given the first two terms F1 and F2
Input:
First line of input contains the number of test cases T. Then the test cases follow.
Each test case consists of two space separated integers F1 and F2, which are the first two terms of the sequence.
Output:
For each test case, output in a single line the number of primes in the first 20 terms of the sequence.
Constraints:
1≤T≤2∗105
2≤F1,F2≤100
Sample Input:
1
100 37
Sample Output:
4

题目大意:

给出斐波那契数列的前两项,求前20项中的素数个数。

题目解析:

这题要判断的数很多,要用线性筛素数。

具体代码:
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
#define ll long long
const int N = 700000;<
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值