AT_abc352_c 题解

· · 题解

思路

这是本人遇到的最简单 ABC-C。

# 代码 ```cpp # include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <int, int> pii; int n, x, y, maxx; ll sum; int main () { ios::sync_with_stdio (0); cin.tie (0); cout.tie (0); cin >> n; while (n --) cin >> x >> y, sum += x, maxx = max (maxx, y - x); cout << maxx + sum; return 0; } ```