QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#475690 | #7897. Largest Digit | Fluoresce# | RE | 0ms | 0kb | C++20 | 1.1kb | 2024-07-13 16:15:11 | 2024-07-13 16:15:12 |
answer
#include<bits/stdc++.h>
#include<unordered_map>
typedef long long ll;
typedef long double ld;
#define debug(a) cout<<a<<'\n'
#define Pll pair<ll,ll>
#define PII pair<int,int>
#define ft first
#define sd second
using namespace std;
const int N = 3e5 + 10, M = 1e7, mod = 998244353;
const ll inf = 1e18;
const ld eps = 1e-8;
ll n, m, k;
int check(ll x) {
int res = 0;
while (x) {
res = max(res*1ll, x % 10);
x = x / 10;
}
return res;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
streambuf* cinbackup=cin.rdbuf(), *coubackup=cout.rdbuf();
ifstream fin("in.txt");
ofstream fout("out.txt");
cin.rdbuf(fin.rdbuf());
cout.rdbuf(fout.rdbuf());
int t;
cin >> t;
ll x, y, z;
while (t--){
ll l1, l2, r1, r2;
cin >> l1 >> r1 >> l2 >> r2;
if (r1 - l1 > 9 || r2 - l2 > 9) {
cout << 9 << '\n';
continue;
}
vector<ll> a1, a2;
for (int i = l1; i <= r1; ++i) {a1.push_back(i);}
for (int i = l2; i <= r2; ++i) {a2.push_back(i);}
int ans = 0;
for (ll x : a1) {
for (ll y : a2) {
ans = max(ans, check(x + y));
}
}
cout << ans << '\n';
}
return 0;
}
詳細信息
Test #1:
score: 0
Dangerous Syscalls
input:
2 178 182 83 85 2 5 3 6