/ SeriousOJ /

Record Detail

Compile Error

foo.cc:14:10: fatal error: template.cpp: No such file or directory
   14 | #include "template.cpp"
      |          ^~~~~~~~~~~~~~
compilation terminated.

Code

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define nl '\n'
#define ws ' '
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define MOD 1000000007

typedef vector<ll> vi;
typedef vector<pair<ll, ll>> vii;

#ifndef ONLINE_JUDGE
#include "template.cpp"
#else
#define debug(...)
#define debugArr(...)
#endif

signed main() {
    FASTIO
    string s;
    ll n;
    cin>>s>>n;
    vi nums;
    string tmp;
    for (char c : s) {
        if (isdigit(c)) tmp += c;
        else if (c == '+') {
            if (!tmp.empty()) {
                nums.push_back(stoll(tmp));
                tmp.clear();
            }
        }
    }
    if (!tmp.empty()) {
        nums.push_back(stoll(tmp));
    }
    debug(nums);
    ll st = nums[0];
    ll diff = nums[1] - nums[0];
    ll sum = 0;
    ll cnt = 0;
    for (ll i = st; cnt < n; i += diff) {
        cnt++;
        sum += i;
    }
    cout<<sum<<nl;
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1231 Busy Friend
Contest
Testing - Intra LU Programming contest 25
Language
C++17 (G++ 13.2.0)
Submit At
2025-08-31 07:18:56
Judged At
2025-08-31 07:18:56
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes