-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMain.java
38 lines (31 loc) · 873 Bytes
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package pat.pat1010;
import java.util.Scanner;
/**
* 1010 一元多项式求导 (25分)
* <p>
* 题目描述: https://pintia.cn/problem-sets/994805260223102976/problems/994805313708867584
*
* @author yangyi
*/
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
boolean isHaveOutput = false;
while (in.hasNext()) {
int coef = in.nextInt();
int expon = in.nextInt();
if (coef * expon != 0) {
if (isHaveOutput) {
System.out.print(" ");
} else {
isHaveOutput = true;
}
System.out.print(coef * expon + " " + (expon - 1));
}
}
in.close();
if (!isHaveOutput) {
System.out.print("0 0");
}
}
}