よじろめ覚書

私の理解度重視のソースコードです。

ABC114B - 754

問題:B - 754

#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(void){
    string s;
    int ans = 753;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> s;
    REP(i, s.length() - 2) {
        ans = min(ans, abs(753 - stoi(s.substr(i, 3))));
    }
    
    cout << ans << "\n";
    return 0;
}