Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
getline(cin, s);
long long a[100], count = 0;
string temp = "";
for(int i = 0; i < s.length(); i++){
char ch = s[i];
if(isdigit(ch)){
temp = temp + ch;
}
else{
if(temp != ""){
a[count] = stoll(temp);
count++;
temp = "";
}
}
if(count == 2){
break;
}
}
long long sum = 0, diff = a[1] - a[0], n;
cin >> n;
for(int i = 0; i < n; i++){
sum = sum + diff;
}
cout << sum << endl;
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1231 Busy Friend
- Contest
- LUCC Presents Intra LU Junior Programming Contest - Replay
- Language
- C++11 (G++ 13.2.0)
- Submit At
- 2025-09-02 17:10:59
- Judged At
- 2025-09-02 17:10:59
- Judged By
- Score
- 0
- Total Time
- 1ms
- Peak Memory
- 532.0 KiB