Accepted
Code
#include <stdio.h>
#include <string.h>
int main() {
char expression[500];
scanf("%s",expression);
long long i=0, first_plus=0,a=0,b=0,n;
while (expression[i] != '+') {
a = a * 10 + (expression[i] - '0');
i++;
}
i++;
while (expression[i] != '+') {
b = b * 10 + (expression[i] - '0');
i++;
}
scanf("%lld",&n);
long long sum = ((2*a + (n-1)*(b-a)) * n) / 2;
printf("%lld",sum);
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1231 Busy Friend
- Contest
- LUCC Presents Intra LU Junior Programming Contest - Replay
- Language
- C99 (GCC 13.2.0)
- Submit At
- 2025-09-02 16:35:40
- Judged At
- 2025-09-02 16:36:39
- Judged By
- Score
- 100
- Total Time
- 1ms
- Peak Memory
- 624.0 KiB