Hi everyone (who after the contest Good evening!) Is Rute!
AtCoder Beginner Contest 177 </ b> is about to begin!
A problem | B problem | C problem |
---|---|---|
This article | in preparation | in preparation |
In this article, I will mainly explain the A problem "Don't be late" </ b>! !!
Takahashi is meeting with Aoki. The meeting place is $ D $ meters away from Takahashi's house, and the meeting time is $ T $ minutes later. When Takahashi leaves home and moves straight to the meeting place at $ S $ meters per minute, determine if he is in time for the meeting place.
・ $ 1 \ leq D \ leq 10000 $ ・ $ 1 \ leq T \ leq 10000 $ ・ $ 1 \ leq S \ leq 10000 $
All you have to do is determine if you are in time for the meeting place. In other words, it is only necessary to determine whether the distance traveled by $ T $ at a speed of $ S $ meters per minute is greater than or equal to $ D $ meters. Expressed as an expression, it is sufficient to conditionally branch whether it is $ D \ leq S × T $.
Below are examples of answers in each language (Python3, Java, C ++).
{ABC177A.py}
d,t,s = map(int,input().split())
if d <= s * t:
print("Yes")
else:
print("No")
{ABC177A.cpp}
#include<bits/stdc++.h>
using namespace std;
int main(){
int d,t,s;
cin >> d >> t >> s;
if ( d <= s * t){
cout << "Yes" << endl;
}else{
cout << "No" << endl;
}
}
{ABC177A.java}
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int d = scan.nextInt();
int t = scan.nextInt();
int s = scan.nextInt();
if (d <= s * t){
System.out.println("Yes");
}else{
System.out.println("No");
}
}
}
Many problems related to conditional branching are also asked at ABC, ABC175 Air Conditioner, ABC164 Sheep and Wolves, etc. Is true.
This concludes the explanation of the A problem </ b>. Next is the explanation of B problem </ b>! !!
Recommended Posts