Розбір
Mishka needs to choose the task that will take the least time. In other words, it is required to calculate the value of .
Algorithm implementation
Read the input data.
scanf("%d %d %d",&t1,&t2,&t3);
Compute the minimum among .
min = t1; if (t2 < min) min = t2; if (t3 < min) min = t3;
Print the answer.
printf("%d\n",min);
Java implementation
import java.util.*; public class Main { public static void main(String[] args) { Scanner con = new Scanner(System.in); int a = con.nextInt(); int b = con.nextInt(); int c = con.nextInt(); int res = a; if (b < res) res = b; if (c < res) res = c; System.out.println(res); con.close(); } }
Java implementation — Math.min
import java.util.*; public class Main { public static void main(String[] args) { Scanner con = new Scanner(System.in); int a = con.nextInt(); int b = con.nextInt(); int c = con.nextInt(); System.out.println(Math.min(Math.min(a,b),c)); con.close(); } }
Python implementation
Read the input data.
t1, t2, t3 = map(int,input().split())
Compute the minimum among .
res = min(t1, t2, t3)
Print the answer.
print(res)