Wrong Answer
Code
import java.util.Scanner;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
int N = sc.nextInt();
s = s.replace(".", "");
String [] str = s.split("\\+");
int []num = new int[str.length];
for(int i =0; i<str.length; i++){
num[i] = Integer.parseInt(str[i]);
}
int diff = 0;
int rst = 0;
if(num.length>1){
diff = num[1] - num[0];
}
for(int i=0; i<N; i++){
rst += num[0] + i*diff;
}
System.out.println(rst);
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1231 Busy Friend
- Contest
- LUCC Presents Intra LU Junior Programming Contest - Replay
- Language
- Java 8 (OpenJDK 1.8.0_422)
- Submit At
- 2025-09-02 17:05:51
- Judged At
- 2025-09-02 17:05:51
- Judged By
- Score
- 10
- Total Time
- 90ms
- Peak Memory
- 11.527 MiB