QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#475690#7897. Largest DigitFluoresce#RE 0ms0kbC++201.1kb2024-07-13 16:15:112024-07-13 16:15:12

Judging History

你现在查看的是最新测评结果

  • [2024-07-13 16:15:12]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-07-13 16:15:11]
  • 提交

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

output:


result: